WithGeneric

Trait WithGeneric 

Source
pub trait WithGeneric: Generic {
    // Required methods
    fn hmap<U: Generic, F>(self, f: F) -> U
       where Self::Repr: HMappable<Poly<F>, Output = U::Repr>;
    fn hzip<U: Generic, TU: Generic<Repr = <Self::Repr as HZippable<U::Repr>>::Zipped>>(
        self,
        other: U,
    ) -> TU
       where Self::Repr: HZippable<U::Repr>;
    fn hzip_with<F, U: Generic, TU: Generic<Repr = <<Self::Repr as HZippable<U::Repr>>::Zipped as HMappable<Poly<F>>>::Output>>(
        self,
        other: U,
        f: F,
    ) -> TU
       where Self::Repr: HZippable<U::Repr>,
             <Self::Repr as HZippable<U::Repr>>::Zipped: HMappable<Poly<F>>;
    fn hzipped_for_each<F, U: Generic>(self, other: U, f: F)
       where Self::Repr: HZippable<U::Repr>,
             <Self::Repr as HZippable<U::Repr>>::Zipped: ForEach<F>;
    fn hzip_to_list<F, U: Generic, O>(
        self,
        other: U,
        f: F,
    ) -> ConsList<O, <<Self::Repr as HZippable<U::Repr>>::Zipped as MapToList<F, O>>::Output>
       where Self::Repr: HZippable<U::Repr>,
             <Self::Repr as HZippable<U::Repr>>::Zipped: MapToList<F, O>;
    fn map_to_list<F, O>(
        self,
        f: F,
    ) -> ConsList<O, <Self::Repr as MapToList<F, O>>::Output>
       where Self::Repr: MapToList<F, O>;
    fn for_each<F>(self, f: F)
       where Self::Repr: ForEach<F>;
    fn fields_into_iter<U>(self) -> impl Iterator<Item = U>
       where Self::Repr: MapToList<Identity, U>;
}
Expand description

Convenience functions for the caller to map between similarly-shaped types implementing Generic without having to explicitly call Generic::from and Generic::into

Required Methods§

Source

fn hmap<U: Generic, F>(self, f: F) -> U
where Self::Repr: HMappable<Poly<F>, Output = U::Repr>,

Source

fn hzip<U: Generic, TU: Generic<Repr = <Self::Repr as HZippable<U::Repr>>::Zipped>>( self, other: U, ) -> TU
where Self::Repr: HZippable<U::Repr>,

Source

fn hzip_with<F, U: Generic, TU: Generic<Repr = <<Self::Repr as HZippable<U::Repr>>::Zipped as HMappable<Poly<F>>>::Output>>( self, other: U, f: F, ) -> TU
where Self::Repr: HZippable<U::Repr>, <Self::Repr as HZippable<U::Repr>>::Zipped: HMappable<Poly<F>>,

Source

fn hzipped_for_each<F, U: Generic>(self, other: U, f: F)
where Self::Repr: HZippable<U::Repr>, <Self::Repr as HZippable<U::Repr>>::Zipped: ForEach<F>,

Source

fn hzip_to_list<F, U: Generic, O>( self, other: U, f: F, ) -> ConsList<O, <<Self::Repr as HZippable<U::Repr>>::Zipped as MapToList<F, O>>::Output>
where Self::Repr: HZippable<U::Repr>, <Self::Repr as HZippable<U::Repr>>::Zipped: MapToList<F, O>,

Source

fn map_to_list<F, O>( self, f: F, ) -> ConsList<O, <Self::Repr as MapToList<F, O>>::Output>
where Self::Repr: MapToList<F, O>,

Source

fn for_each<F>(self, f: F)
where Self::Repr: ForEach<F>,

Source

fn fields_into_iter<U>(self) -> impl Iterator<Item = U>
where Self::Repr: MapToList<Identity, U>,

Allows getting an iterator over the fields of a struct if they all have the same type

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§