pub struct CanIso<R, S>{ /* private fields */ }
Expand description
A wrapper around CanIsoFromTo::Isomorphism
that references the domain and
codomain rings, making it much easier to use. This also contains the homomorphism
in the other direction, i.e. allows mapping in both directions.
§Example
let from = StaticRing::<i32>::RING;
let to = StaticRing::<i64>::RING;
let hom = to.can_iso(&from).unwrap();
assert_eq!(7, hom.map(7));
// instead of
let hom = to.get_ring().has_canonical_iso(from.get_ring()).unwrap();
assert_eq!(7, from.get_ring().map_out(to.get_ring(), 7, &hom));
§See also
The “one-directional” variant CanHom
, the basic interfaces CanHomFrom
and
CanIsoFromTo
and the very simplified function RingStore::coerce()
.
Implementations§
Trait Implementations§
Source§impl<R, S> Homomorphism<<S as RingStore>::Type, <R as RingStore>::Type> for CanIso<R, S>
impl<R, S> Homomorphism<<S as RingStore>::Type, <R as RingStore>::Type> for CanIso<R, S>
type DomainStore = S
type CodomainStore = R
fn map(&self, x: El<S>) -> El<R>
fn domain(&self) -> &S
fn codomain(&self) -> &R
fn map_ref(&self, x: &Domain::Element) -> Codomain::Element
fn mul_assign_map(&self, lhs: &mut Codomain::Element, rhs: Domain::Element)
fn mul_assign_ref_map(&self, lhs: &mut Codomain::Element, rhs: &Domain::Element)
fn mul_map( &self, lhs: Codomain::Element, rhs: Domain::Element, ) -> Codomain::Element
fn mul_ref_fst_map( &self, lhs: &Codomain::Element, rhs: Domain::Element, ) -> Codomain::Element
fn mul_ref_snd_map( &self, lhs: Codomain::Element, rhs: &Domain::Element, ) -> Codomain::Element
fn mul_ref_map( &self, lhs: &Codomain::Element, rhs: &Domain::Element, ) -> Codomain::Element
fn compose<F, PrevDomain: ?Sized + RingBase>(
self,
prev: F,
) -> ComposedHom<PrevDomain, Domain, Codomain, F, Self>where
Self: Sized,
F: Homomorphism<PrevDomain, Domain>,
Auto Trait Implementations§
impl<R, S> Freeze for CanIso<R, S>where
R: Freeze,
S: Freeze,
<<S as RingStore>::Type as CanIsoFromTo<<R as RingStore>::Type>>::Isomorphism: Freeze,
impl<R, S> RefUnwindSafe for CanIso<R, S>where
R: RefUnwindSafe,
S: RefUnwindSafe,
<<S as RingStore>::Type as CanIsoFromTo<<R as RingStore>::Type>>::Isomorphism: RefUnwindSafe,
impl<R, S> Send for CanIso<R, S>where
R: Send,
S: Send,
<<S as RingStore>::Type as CanIsoFromTo<<R as RingStore>::Type>>::Isomorphism: Send,
impl<R, S> Sync for CanIso<R, S>where
R: Sync,
S: Sync,
<<S as RingStore>::Type as CanIsoFromTo<<R as RingStore>::Type>>::Isomorphism: Sync,
impl<R, S> Unpin for CanIso<R, S>where
R: Unpin,
S: Unpin,
<<S as RingStore>::Type as CanIsoFromTo<<R as RingStore>::Type>>::Isomorphism: Unpin,
impl<R, S> UnwindSafe for CanIso<R, S>where
R: UnwindSafe,
S: UnwindSafe,
<<S as RingStore>::Type as CanIsoFromTo<<R as RingStore>::Type>>::Isomorphism: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more