-
Notifications
You must be signed in to change notification settings - Fork 184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
impl ExportableProvider for ForkByErrorProvider and add tutorial #5503
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
f598c4b
impl ExportableProvider for ForkByErrorProvider and add tutorial
sffc 4e0e208
Add impl for MultiForkByErrorProvider
sffc 4228f57
Features
sffc 8035fab
fmt manually
sffc 3d67094
features
sffc e880221
Merge remote-tracking branch 'origin/main' into exportable-impl
sffc ee8979f
Add more impls
sffc f8955d6
Update provider/adapters/src/fork/by_error.rs
sffc 0eaff22
features
sffc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -4,6 +4,8 @@ | |||||||||
|
||||||||||
use super::ForkByErrorPredicate; | ||||||||||
use alloc::{collections::BTreeSet, vec::Vec}; | ||||||||||
#[cfg(feature = "export")] | ||||||||||
use icu_provider::export::ExportableProvider; | ||||||||||
use icu_provider::prelude::*; | ||||||||||
|
||||||||||
/// A provider that returns data from one of two child providers based on a predicate function. | ||||||||||
|
@@ -159,6 +161,20 @@ where | |||||||||
} | ||||||||||
} | ||||||||||
|
||||||||||
#[cfg(feature = "export")] | ||||||||||
impl<P0, P1, F> ExportableProvider for ForkByErrorProvider<P0, P1, F> | ||||||||||
where | ||||||||||
P0: ExportableProvider, | ||||||||||
P1: ExportableProvider, | ||||||||||
F: ForkByErrorPredicate + Sync, | ||||||||||
{ | ||||||||||
fn supported_markers(&self) -> std::collections::HashSet<DataMarkerInfo> { | ||||||||||
let mut markers = self.0.supported_markers(); | ||||||||||
markers.extend(self.1.supported_markers()); | ||||||||||
markers | ||||||||||
Comment on lines
+172
to
+174
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure |
||||||||||
} | ||||||||||
} | ||||||||||
|
||||||||||
/// A provider that returns data from the first child provider passing a predicate function. | ||||||||||
/// | ||||||||||
/// This is an abstract forking provider that must be provided with a type implementing the | ||||||||||
|
@@ -334,3 +350,17 @@ where | |||||||||
Err(last_error) | ||||||||||
} | ||||||||||
} | ||||||||||
|
||||||||||
#[cfg(feature = "export")] | ||||||||||
impl<P, F> ExportableProvider for MultiForkByErrorProvider<P, F> | ||||||||||
where | ||||||||||
P: ExportableProvider, | ||||||||||
F: ForkByErrorPredicate + Sync, | ||||||||||
{ | ||||||||||
fn supported_markers(&self) -> std::collections::HashSet<DataMarkerInfo> { | ||||||||||
self.providers | ||||||||||
.iter() | ||||||||||
.flat_map(|p| p.supported_markers()) | ||||||||||
.collect() | ||||||||||
} | ||||||||||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems incomplete to not implement
ExportableProvider
on all adapter types.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ForkByMarkerProvider
andMultiForkByMarkerProvider
are still missing.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.