pub enum SArc<T: 'static + ?Sized> {
Static(&'static T),
Arc(Arc<T>),
}Expand description
Either a static reference or an Arc.
SArc is useful when declaring types that can refer to static data as well as data initialized
at runtime. Arc::new() is not usable in const contexts, in which case SArc::Static can be
used, while using SArc::Arc for all other uses.
Variants§
Static(&'static T)
Arc(Arc<T>)
Implementations§
Trait Implementations§
impl<T: 'static + ?Sized + Eq> Eq for SArc<T>
Auto Trait Implementations§
impl<T> Freeze for SArc<T>
impl<T> RefUnwindSafe for SArc<T>
impl<T> Send for SArc<T>
impl<T> Sync for SArc<T>
impl<T> Unpin for SArc<T>
impl<T> UnsafeUnpin for SArc<T>
impl<T> UnwindSafe for SArc<T>
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