pub struct StaticType<T> { /* private fields */ }
Implementations§
Source§impl<T> StaticType<T>
impl<T> StaticType<T>
pub const fn new() -> Self
pub fn is_init(&self) -> bool
pub fn init_call<F: FnOnce() -> T>(&self, call: F)
pub fn get_or_init<F: FnOnce() -> T>(&self, call: F) -> &T
Sourcepub fn get_static(&self) -> Option<&T>
pub fn get_static(&self) -> Option<&T>
this fn not safed; please before use this fn must use init_call
or get_or_init
Sourcepub fn get_static_unchecked(&self) -> &T
pub fn get_static_unchecked(&self) -> &T
this fn not safed; please before use this fn must use init_call
or get_or_init
Sourcepub fn get_mut(&self) -> &mut Option<T>
pub fn get_mut(&self) -> &mut Option<T>
this fn not safed; please before use this fn must use init_call
or get_or_init
pub fn get_safe(&self) -> Option<&T>
pub fn force_drop(&self) -> Option<T>
Trait Implementations§
Source§impl<T> AsRef<T> for StaticType<T>
impl<T> AsRef<T> for StaticType<T>
Source§impl<T: Debug> Debug for StaticType<T>
impl<T: Debug> Debug for StaticType<T>
Source§impl<T: Default> Default for StaticType<T>
impl<T: Default> Default for StaticType<T>
Source§impl<T> Deref for StaticType<T>
impl<T> Deref for StaticType<T>
Source§impl<T> DerefMut for StaticType<T>
impl<T> DerefMut for StaticType<T>
Source§impl<T: Display> Display for StaticType<T>
impl<T: Display> Display for StaticType<T>
impl<T> Send for StaticType<T>
impl<T> Sync for StaticType<T>
Auto Trait Implementations§
impl<T> !Freeze for StaticType<T>
impl<T> !RefUnwindSafe for StaticType<T>
impl<T> Unpin for StaticType<T>where
T: Unpin,
impl<T> UnwindSafe for StaticType<T>where
T: 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