pub struct Workspace { /* private fields */ }
Expand description
A workspace that contains type-erased objects.
The workspace is intended to hold intermediate data used as workspace in computations. It is optimized particularly for the case where the same type is accessed many times in a row.
Usually you do not need to use this type directly. Instead, use
define_thread_local_workspace
in conjunction with
with_thread_local_workspace
as described in the
crate-level documentation.
Implementations
sourceimpl Workspace
impl Workspace
sourcepub fn try_insert<W: 'static>(&mut self, w: W) -> Option<&mut W>
pub fn try_insert<W: 'static>(&mut self, w: W) -> Option<&mut W>
Attempts to insert the given object into the workspace.
If the insertion was successful, a reference to the object is returned. Otherwise,
None
is returned.
pub fn try_get<W: 'static>(&self) -> Option<&W>
pub fn try_get_mut<W: 'static>(&mut self) -> Option<&mut W>
pub fn get_or_insert_with<W, F>(&mut self, create: F) -> &mut Wwhere
W: 'static,
F: FnOnce() -> W,
pub fn get_or_default<W>(&mut self) -> &mut Wwhere
W: 'static + Default,
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Workspace
impl !Send for Workspace
impl !Sync for Workspace
impl Unpin for Workspace
impl !UnwindSafe for Workspace
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more