pub struct Owned<T> { /* private fields */ }Expand description
Single-threaded owner for values remembered by the Composer.
This type stores T inside an Rc<RefCell<...>>, allowing cheap cloning of the
handle while keeping ownership of T within the composition.
Implementations§
Source§impl<T> Owned<T>
impl<T> Owned<T>
pub fn new(value: T) -> Self
Sourcepub fn with<R>(&self, f: impl FnOnce(&T) -> R) -> R
pub fn with<R>(&self, f: impl FnOnce(&T) -> R) -> R
Run f with an immutable reference to the stored value.
Sourcepub fn update<R>(&self, f: impl FnOnce(&mut T) -> R) -> R
pub fn update<R>(&self, f: impl FnOnce(&mut T) -> R) -> R
Run f with a mutable reference to the stored value.
Sourcepub fn borrow_mut(&self) -> RefMut<'_, T>
pub fn borrow_mut(&self) -> RefMut<'_, T>
Borrow the stored value mutably.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Owned<T>
impl<T> !RefUnwindSafe for Owned<T>
impl<T> !Send for Owned<T>
impl<T> !Sync for Owned<T>
impl<T> Unpin for Owned<T>
impl<T> !UnwindSafe for Owned<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