pub enum Either<Own, Base> {
Own(Own),
Direct(Base),
}Expand description
A 2-variant generic enum, useful for writing implementations that provide some own variants on those passed on directly to a base.
It implements various traits depending on the own and base trait; currently, just as AsRef.
§Caveats
Do not use this to extend own enums, as those will become types with their fixed layout that might easily use the very same discriminator field as the underlying type, and thus defeat possible optimizations.
Variants§
Trait Implementations§
impl<Own: Eq, Base: Eq> Eq for Either<Own, Base>
impl<Own: PartialEq, Base: PartialEq> StructuralPartialEq for Either<Own, Base>
Auto Trait Implementations§
impl<Own, Base> Freeze for Either<Own, Base>
impl<Own, Base> RefUnwindSafe for Either<Own, Base>where
Own: RefUnwindSafe,
Base: RefUnwindSafe,
impl<Own, Base> Send for Either<Own, Base>
impl<Own, Base> Sync for Either<Own, Base>
impl<Own, Base> Unpin for Either<Own, Base>
impl<Own, Base> UnsafeUnpin for Either<Own, Base>where
Own: UnsafeUnpin,
Base: UnsafeUnpin,
impl<Own, Base> UnwindSafe for Either<Own, Base>where
Own: UnwindSafe,
Base: 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