Enum EitherCart
enum EitherCart<C0, C1>
A cart that can be one type or the other. Enables ergonomic polymorphic carts.
EitherCart enables yokes originating from different data sources and therefore
having different cart types to be merged into the same yoke type, but still being
able to recover the original cart type if necessary.
All relevant Cart traits are implemented for EitherCart, and carts can be
safely wrapped in an EitherCart.
Also see Yoke::erase_box_cart().
Examples
use Rc;
use EitherCart;
use Yoke;
let y1: =
attach_to_zero_copy_cart;
let y2: = attach_to_zero_copy_cart;
type CombinedYoke<'a> = ;
// Both yokes can be combined into a single yoke type despite different carts
let y3: CombinedYoke = y1.wrap_cart_in_either_a;
let y4: CombinedYoke = y2.wrap_cart_in_either_b;
assert_eq!;
assert_eq!;
// The resulting yoke is cloneable if both cart types implement CloneableCart
let y5 = y4.clone;
assert_eq!;
Variants
-
A(C0) -
B(C1)
Implementations
impl<C0, C1> CloneableCart for EitherCart<C0, C1>
impl<C0, C1> Freeze for EitherCart<C0, C1>
impl<C0, C1> RefUnwindSafe for EitherCart<C0, C1>
impl<C0, C1> Send for EitherCart<C0, C1>
impl<C0, C1> StructuralPartialEq for EitherCart<C0, C1>
impl<C0, C1> Sync for EitherCart<C0, C1>
impl<C0, C1> Unpin for EitherCart<C0, C1>
impl<C0, C1> UnsafeUnpin for EitherCart<C0, C1>
impl<C0, C1> UnwindSafe for EitherCart<C0, C1>
impl<C0, C1, T> Deref for EitherCart<C0, C1>
fn deref(self: &Self) -> &T
impl<C0, C1, T> StableDeref for EitherCart<C0, C1>
impl<C0: $crate::clone::Clone, C1: $crate::clone::Clone> Clone for EitherCart<C0, C1>
fn clone(self: &Self) -> EitherCart<C0, C1>
impl<C0: $crate::cmp::Eq, C1: $crate::cmp::Eq> Eq for EitherCart<C0, C1>
impl<C0: $crate::cmp::PartialEq, C1: $crate::cmp::PartialEq> PartialEq for EitherCart<C0, C1>
fn eq(self: &Self, other: &EitherCart<C0, C1>) -> bool
impl<C0: $crate::fmt::Debug, C1: $crate::fmt::Debug> Debug for EitherCart<C0, C1>
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result
impl<P, T> Receiver for EitherCart<C0, C1>
impl<T> Any for EitherCart<C0, C1>
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for EitherCart<C0, C1>
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for EitherCart<C0, C1>
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> CloneToUninit for EitherCart<C0, C1>
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)
impl<T> ErasedDestructor for EitherCart<C0, C1>
impl<T> From for EitherCart<C0, C1>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for EitherCart<C0, C1>
fn to_owned(self: &Self) -> Tfn clone_into(self: &Self, target: &mut T)
impl<T, U> Into for EitherCart<C0, C1>
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for EitherCart<C0, C1>
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for EitherCart<C0, C1>
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>