Struct cell_family::Cell
source · Expand description
Implementations§
source§impl<F: Family, T> Cell<F, T>
impl<F: Family, T> Cell<F, T>
sourcepub const fn new(value: T) -> Self
pub const fn new(value: T) -> Self
Creates a new cell which wraps the given value, and whose value can be
borrowed by a CellOwner
.
sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Returns the inner value, consuming the cell.
source§impl<F: Family, T: ?Sized> Cell<F, T>
impl<F: Family, T: ?Sized> Cell<F, T>
sourcepub fn get<'a>(&'a self, owner: &'a CellOwner<F>) -> &'a T
pub fn get<'a>(&'a self, owner: &'a CellOwner<F>) -> &'a T
Returns a reference to the underlying value of the cell, using the
reference to the given CellOwner
as a proof that this cell is not
currently mutably borrowed.
sourcepub unsafe fn get_unchecked(&self) -> &T
pub unsafe fn get_unchecked(&self) -> &T
Returns a reference to the underlying value of the cell without any checks.
Safety
When calling this method, you have to ensure that the current cell (and its underlying data) is not borrowed mutably for the entire lifetime of the returned reference.
sourcepub fn get_mut<'a>(&'a self, owner: &'a mut CellOwner<F>) -> &'a mut T
pub fn get_mut<'a>(&'a self, owner: &'a mut CellOwner<F>) -> &'a mut T
Returns a reference to the underlying value of the cell, using the
reference to the given CellOwner
as a proof that this cell is not
currently mutably borrowed.
sourcepub unsafe fn get_unchecked_mut(&self) -> &mut T
pub unsafe fn get_unchecked_mut(&self) -> &mut T
Returns a mutable reference to the underlying value of the cell without any checks.
Safety
When calling this method, you have to ensure that the current cell (and its underlying data) is not borrowed anywhere else for the entire lifetime of the returned reference.
Trait Implementations§
source§impl<F: Family, T: Debug + ?Sized> Debug for Cell<F, T>
impl<F: Family, T: Debug + ?Sized> Debug for Cell<F, T>
source§impl<'a, F: Family, T: ?Sized> GetMutWithOwner<'a, F> for &'a Cell<F, T>
impl<'a, F: Family, T: ?Sized> GetMutWithOwner<'a, F> for &'a Cell<F, T>
§type GetMut = &'a mut T
type GetMut = &'a mut T
Self::get_mut()
.