IsoFn

Trait IsoFn 

Source
pub trait IsoFn<'x>: Iso<'x>
where Self::V: SpecIso<Src = <Self::Src as View>::V, Dst = <Self::Dst as View>::V>, <Self::Src as View>::V: SpecFrom<<Self::Dst as View>::V>, <Self::Dst as View>::V: SpecFrom<<Self::Src as View>::V>, Self::Dst: 'x,
{ // Required methods exec fn apply(s: Self::Src) -> res : Self::Dst; exec fn rev_apply(s: &'x Self::Dst) -> res : Self::RefSrc; }
Expand description

The bijective functions of Iso Self::apply and Self::rev_apply must be inverses of each other. See [SpecIsoFn::spec_iso] and [SpecIsoFn::spec_iso_rev] for more details.

Required Methods§

Source

exec fn apply(s: Self::Src) -> res : Self::Dst

ensures
res@ == Self::V::spec_apply(s@),

Applies the isomorphism to the source type.

Source

exec fn rev_apply(s: &'x Self::Dst) -> res : Self::RefSrc

ensures
res@ == Self::V::spec_rev_apply(s@),

Applies the reverse isomorphism to the destination 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§

Source§

impl<'x, T: Iso<'x>> IsoFn<'x> for T
where T::V: SpecIso<Src = <T::Src as View>::V, Dst = <T::Dst as View>::V>, <T::Src as View>::V: SpecFrom<<T::Dst as View>::V>, <T::Dst as View>::V: SpecFrom<<T::Src as View>::V>, Self::Dst: 'x,