pub trait Splittable: Sized {
type Key: 'static + Send + Sync + Eq + Hash + Clone + Debug;
type Identifier: 'static + Send + Sync;
type Item: 'static + Send + Sync;
// Required methods
fn validate(key: &Self::Key) -> bool;
fn next(key: &Option<Self::Key>) -> Option<Self::Key>;
fn split(
self,
dispatcher: SplitDispatcher<'_, Self::Key, Self::Identifier, Self::Item>,
) -> OperationResult;
}Expand description
Implementing this trait on a struct will allow the Chain::split operation
to be performed on outputs of that type.
Required Associated Types§
Sourcetype Key: 'static + Send + Sync + Eq + Hash + Clone + Debug
type Key: 'static + Send + Sync + Eq + Hash + Clone + Debug
The key used to identify different elements in the split
Sourcetype Identifier: 'static + Send + Sync
type Identifier: 'static + Send + Sync
An identifier that will be included along with the item in the messages that are produced by the split. In other words, each message in the split will be a tuple of (Identiifer, Item). You can then choose to map away the identifier if you don’t need it.
This may be different from the key, because a key can represent entire groups of items.
Required Methods§
Sourcefn validate(key: &Self::Key) -> bool
fn validate(key: &Self::Key) -> bool
Return true if the key is feasible for this type of split, otherwise
return false. Returning false will cause the user to receive a
SplitConnectionError::KeyOutOfBounds. This will also cause iterating
to cease.
Sourcefn split(
self,
dispatcher: SplitDispatcher<'_, Self::Key, Self::Identifier, Self::Item>,
) -> OperationResult
fn split( self, dispatcher: SplitDispatcher<'_, Self::Key, Self::Identifier, Self::Item>, ) -> OperationResult
Split the value into its parts
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".