pub struct MLRefCell<T: ?Sized> { /* private fields */ }
Expand description

A RefCell which can be “locked” to prevent future mutable borrows

Implementations

Creates a new MLRefCell containing value

Consumes the MLRefCell, returning the wrapped value

Replaces the wrapped value with a new one, returning the old value, without deinitializing either one. This function corresponds to std::mem::replace.

Replaces the wrapped value with a new one computed from f, returning the old value, without deinitializing either one.

Swaps the wrapped value of self with the wrapped value of other, without deinitializing either one. This function corresponds to std::mem:swap.

Locks the MLRefCell, so that future mutable borrows will result in an error.

Returns whether the MLRefCell is locked.

Immutably borrows the wrapped value, panicking if the value is currently mutably borrowed.

Immutably borrows the wrapped value, returning a BorrowError if the value is currently mutably borrowed.

Mutably borrows the wrapped value, panicking if the value is either currently borrowed or if the MLRefCell is locked.

Mutably borrows the wrapped value, returning an error if the value is either currently borrowed or if the MLRefCell is locked.

Returns a raw pointer to the underlying data in this cell.

Returns a mutable reference to the underlying data. This call borrows self mutably, so there is no need for runtime checks (including lock checks). This method is usually not what you want, so use borrow_mut instead.

Immutably borrows the wrapped value, returning an error if the value is currently mutably borrowed. Unlike RefCell::borrow, this method is unsafe because it does not return a Ref, thus leaving the borrow flag untouched. Mutably borrowing the RefCell while the reference returned by this method is alive is undefined behaviour.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

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 resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

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.