pub struct Current<T>(/* private fields */);
Expand description
The current value of a type.
Implementations§
Source§impl<T> Current<T>where
T: Any,
impl<T> Current<T>where
T: Any,
Sourcepub unsafe fn current(&mut self) -> Option<&mut T>
pub unsafe fn current(&mut self) -> Option<&mut T>
Gets mutable reference to current object. Requires mutable reference to prevent access to globals in safe code, and to prevent mutable borrows of same value in scope. Is unsafe because returned reference inherits lifetime from argument.
Sourcepub unsafe fn current_unwrap(&mut self) -> &mut T
pub unsafe fn current_unwrap(&mut self) -> &mut T
Unwraps mutable reference to current object, but with nicer error message.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Current<T>
impl<T> RefUnwindSafe for Current<T>where
T: RefUnwindSafe,
impl<T> Send for Current<T>where
T: Send,
impl<T> Sync for Current<T>where
T: Sync,
impl<T> Unpin for Current<T>where
T: Unpin,
impl<T> UnwindSafe for Current<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