Struct triomphe::ArcUnion [−][src]
pub struct ArcUnion<A, B> { /* fields omitted */ }Expand description
A tagged union that can represent Arc<A> or Arc<B> while only consuming a
single word. The type is also NonNull, and thus can be stored in an Option
without increasing size.
This is functionally equivalent to
enum ArcUnion<A, B> { First(Arc<A>), Second(Arc<B>) but only takes up
up a single word of stack space.
This could probably be extended to support four types if necessary.
Implementations
Returns true if the two values are pointer-equal.
Returns an enum representing a borrow of either A or B.
Creates an ArcUnion from an instance of the first type.
Creates an ArcUnion from an instance of the second type.
Returns a borrow of the first type if applicable, otherwise None.
Trait Implementations
Auto Trait Implementations
impl<A, B> RefUnwindSafe for ArcUnion<A, B> where
A: RefUnwindSafe,
B: RefUnwindSafe, impl<A, B> UnwindSafe for ArcUnion<A, B> where
A: UnwindSafe,
B: UnwindSafe, Blanket Implementations
Mutably borrows from an owned value. Read more