Struct qcell::QCell

source · []
pub struct QCell<T: ?Sized> { /* private fields */ }
Expand description

Cell whose contents is owned (for borrowing purposes) by a QCellOwner, a QCellOwnerSeq or a QCellOwnerPinned.

To borrow from this cell, use the borrowing calls on the owner instance that was used to create it. For QCellOwner, there are also convenience methods QCell::ro and QCell::rw. See also crate documentation.

Implementations

Create a new QCell owned for borrowing purposes by the owner with the given QCellOwnerID, or a type that can be converted into a QCellOwnerID, such as &owner. So calls will typically take the form QCell::new(&owner, value) or QCell::new(owner_id, value).

Destroy the cell and return the contained value

Safety: Since this consumes the cell, there can be no other references to the cell or the data at this point.

Convenience method to borrow a cell immutably when the owner is a QCellOwner. Equivalent to QCellOwner::ro. See QCellOwnerSeq::ro or QCellOwnerPinned::ro to borrow for other owner types.

Convenience method to borrow a cell mutably when the owner is a QCellOwner. Equivalent to QCellOwner::rw. See QCellOwnerSeq::rw or QCellOwnerPinned::rw to borrow for other owner types.

Returns a mutable reference to the underlying data

Note that this is only useful at the beginning-of-life or end-of-life of the cell when you have exclusive access to it. Normally you’d use QCell::rw or QCellOwner::rw to get a mutable reference to the contents of the cell.

Safety: This call borrows QCell mutably which guarantees that we possess the only reference. This means that there can be no active borrows of other forms, even ones obtained using an immutable reference.

Trait Implementations

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.