pub struct StaticInstances<T>where
T: Object,{ /* private fields */ }Expand description
This is the real type of variables wrapped in the linked::instances! macro.
See macro documentation for more details.
Instances of this type are created by the linked::instances! macro,
never directly by user code, which can use .get() to obtain a linked instance of T.
Implementations§
Source§impl<T> StaticInstances<T>where
T: Object,
impl<T> StaticInstances<T>where
T: Object,
Sourcepub fn get(&self) -> T
pub fn get(&self) -> T
Creates a new linked instance of T from the same family of linked objects as other
instances created via the same static variable.
§Performance
This creates a new instance of T on every call so caching the return value is
performance-critical.
If you only need one instance per thread, consider using the linked::thread_local_rc!
or linked::thread_local_arc! macro for a more efficient solution.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for StaticInstances<T>
impl<T> RefUnwindSafe for StaticInstances<T>
impl<T> Send for StaticInstances<T>
impl<T> Sync for StaticInstances<T>
impl<T> Unpin for StaticInstances<T>
impl<T> UnwindSafe for StaticInstances<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