Skip to main content

SeparateDispatch

Trait SeparateDispatch 

Source
pub trait SeparateDispatch<'a, Brand: Kind_cdc7cd43dac7585f, E: 'a, O: 'a, Marker> {
    // Required method
    fn dispatch(
        self,
    ) -> (<Brand as Kind_cdc7cd43dac7585f>::Of<'a, E>, <Brand as Kind_cdc7cd43dac7585f>::Of<'a, O>);
}
Expand description

Trait that routes a separate operation to the appropriate type class method.

The Marker type parameter is an implementation detail resolved by the compiler from the container type; callers never specify it directly. Owned containers resolve to Val, borrowed containers resolve to Ref.

§Type Parameters

  • 'a: The lifetime of the values.
  • Brand: The brand of the compactable.
  • E: The error type inside the Result wrappers.
  • O: The success type inside the Result wrappers.
  • Marker: Dispatch marker type, inferred automatically. Either Val or Ref.

Required Methods§

Source

fn dispatch( self, ) -> (<Brand as Kind_cdc7cd43dac7585f>::Of<'a, E>, <Brand as Kind_cdc7cd43dac7585f>::Of<'a, O>)

Perform the dispatched separate operation.

§Type Signature

self -> (Brand E, Brand O)

§Returns

A tuple of two containers: Err values and Ok values.

§Examples
use fp_library::{
	brands::*,
	functions::explicit::*,
};

let (errs, oks) = separate::<VecBrand, _, _, _, _>(vec![Ok(1), Err(2), Ok(3)]);
assert_eq!(oks, vec![1, 3]);
assert_eq!(errs, vec![2]);

Implementors§

Source§

impl<'a, Brand, E, O> SeparateDispatch<'a, Brand, E, O, Ref> for &<Brand as Kind_cdc7cd43dac7585f>::Of<'a, Result<O, E>>
where Brand: RefCompactable, E: 'a + Clone, O: 'a + Clone,

Routes borrowed containers to RefCompactable::ref_separate.

§Type Parameters
  • 'a: The lifetime of the values.
  • Brand: The brand of the compactable.
  • E: The error type inside the Result wrappers.
  • O: The success type inside the Result wrappers.
Source§

impl<'a, Brand, E, O> SeparateDispatch<'a, Brand, E, O, Val> for <Brand as Kind_cdc7cd43dac7585f>::Of<'a, Result<O, E>>
where Brand: Compactable, E: 'a, O: 'a,

Routes owned containers to Compactable::separate.

§Type Parameters
  • 'a: The lifetime of the values.
  • Brand: The brand of the compactable.
  • E: The error type inside the Result wrappers.
  • O: The success type inside the Result wrappers.