Struct qcell::TCellOwner[][src]

pub struct TCellOwner<Q: 'static> { /* fields omitted */ }
Expand description

Borrowing-owner of zero or more TCell instances.

See crate documentation.

Implementations

Create the singleton owner instance. Each owner may be used to create many TCell instances. There may be only one instance of this type per process at any given time for each different marker type Q. This call panics if a second simultaneous instance is created.

Keep in mind that in Rust, tests are run in parallel unless specified otherwise (using e.g. RUST_TEST_THREADS), so this panic may be more easy to trigger than you might think. To avoid this panic, consider using the methods TCellOwner::wait_for_new or TCellOwner::try_new instead.

Same as TCellOwner::new, except if another TCellOwner of this type Q already exists, this returns None instead of panicking.

Same as TCellOwner::new, except if another TCellOwner of this type Q already exists, this function blocks the thread until that other instance is dropped. This will of course deadlock if that other instance is owned by the same thread.

Note that owners are expected to be relatively long-lived. If you need to access cells associated with a given marker type from several different threads, the most efficient pattern is to have a single long-lived owner shared between threads, with a Mutex or RwLock to control access. This call is intended to help when several independent tests need to run which use the same marker type internally.

Create a new cell owned by this owner instance. See also TCell::new.

Borrow contents of a TCell immutably (read-only). Many TCell instances can be borrowed immutably at the same time from the same owner.

Borrow contents of a TCell mutably (read-write). Only one TCell at a time can be borrowed from the owner using this call. The returned reference must go out of scope before another can be borrowed.

Borrow contents of two TCell instances mutably. Panics if the two TCell instances point to the same memory.

Borrow contents of three TCell instances mutably. Panics if any pair of TCell instances point to the same memory.

Trait Implementations

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

Executes the destructor for this 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

Performs the conversion.

Performs the conversion.

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.