Struct r3_core::bind::Bind

source ·
pub struct Bind<'pool, System, T> { /* private fields */ }
Expand description

A defined binding.

The configuration-time metadata is stored in a pool with lifetime 'pool.

Implementations

Construct a BindDefiner to define a binding in a configuration function.

Binders

The following methods are used to construct a binder, which is a reference to a binding with a specific borrowing mode.

Create a BindBorrow binder, which gives &T to a bound function.

Create a BindBorrowMut binder, which gives &mut T to a bound function.

Create a BindTake binder, which gives T to a bound function.

Create a BindTakeRef binder, which gives &'static T to a bound function.

Create a BindTakeMut binder, which gives &'static mut T to a bound function.

Construct a BindRef, which can be used to get &'static T from a BindTable<System>.

BindRef doubles as a binder that gives &'static T in a bound executable object.

The configuration system can’t track the usages of BindRef (note the lack of a lifetime parameter in its definition). As such, merely calling this method counts as a use of the binding whether the returned BindRef is actually used or not.

Get the raw Hunk providing the backing store for this binding.

The referent type of the returned Hunk is an opaque type that has the same representation as T (because of #[repr(transparent)]). You can use Hunk::transmute to reinterpret it as you see fit.

Calling this method alone does not extend the binding’s lifetime nor prevent conflicting borrows from occurring. A dummy binding can be used to express the manner in which the raw hunk is used outside the configuration system’s knowledge. For example, if the raw hunk is going to be mutably borrowed, the caller of this method should create a dummy unpure binding that consumes the binding by take_mut.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Destruct Bind into individual bindings.
Destruct Bind into individual bindings.
Destruct Bind into individual bindings.
Destruct Bind into individual bindings.
Destruct Bind into individual bindings.
Destruct Bind into individual bindings.
Destruct Bind into individual bindings.
Destruct Bind into individual bindings.
Destruct Bind into individual bindings.
Destruct Bind into individual bindings.
Destruct Bind into individual bindings.
Destruct Bind into individual bindings.
Destruct Bind into individual bindings.
Destruct Bind into individual bindings.
Destruct Bind into individual bindings.
Destruct Bind into individual bindings.
Destruct Bind into individual bindings.

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.