pub struct PerAccessStatic<T>where
T: Object,{ /* private fields */ }
Expand description
This is the real type of variables wrapped in the linked::instance_per_access!
macro.
See macro documentation for more details.
Instances of this type are created by the linked::instance_per_access!
macro,
never directly by user code. User code will simply call .get()
on this type when it
wants to obtain an instance of the linked object T
.
Implementations§
Source§impl<T> PerAccessStatic<T>where
T: Object,
impl<T> PerAccessStatic<T>where
T: Object,
Sourcepub fn get(&self) -> T
pub fn get(&self) -> T
Gets a new T
instance from the family of linked objects.
§Performance
This creates a new instance of T
on every call so caching the return value is
performance-critical.
Consider using the linked::instance_per_thread!
macro if you want to
maintain only one instance per thread and return shared references to it.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for PerAccessStatic<T>
impl<T> RefUnwindSafe for PerAccessStatic<T>
impl<T> Send for PerAccessStatic<T>
impl<T> Sync for PerAccessStatic<T>
impl<T> Unpin for PerAccessStatic<T>
impl<T> UnwindSafe for PerAccessStatic<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