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§
source§impl<'pool, System> Bind<'pool, System, ()>
impl<'pool, System> Bind<'pool, System, ()>
sourcepub const fn define() -> BindDefiner<System, BinderUnspecified, FuncUnspecified>
pub const fn define() -> BindDefiner<System, BinderUnspecified, FuncUnspecified>
Construct a BindDefiner
to define a binding in a configuration
function.
source§impl<'pool, System, T> Bind<'pool, System, T>
impl<'pool, System, T> Bind<'pool, System, T>
Binders
The following methods are used to construct a binder, which is a reference to a binding with a specific borrowing mode.
sourcepub const fn borrow(&self) -> BindBorrow<'pool, System, T>where
T: Sync,
pub const fn borrow(&self) -> BindBorrow<'pool, System, T>where T: Sync,
Create a BindBorrow
binder, which gives &T
to a bound function.
sourcepub const fn borrow_mut(&self) -> BindBorrowMut<'pool, System, T>where
T: Send,
pub const fn borrow_mut(&self) -> BindBorrowMut<'pool, System, T>where T: Send,
Create a BindBorrowMut
binder, which gives &mut T
to a bound
function.
sourcepub const fn take(&self) -> BindTake<'pool, System, T>where
T: Send,
pub const fn take(&self) -> BindTake<'pool, System, T>where T: Send,
Create a BindTake
binder, which gives T
to a bound function.
sourcepub const fn take_ref(&self) -> BindTakeRef<'pool, System, T>where
T: Sync,
pub const fn take_ref(&self) -> BindTakeRef<'pool, System, T>where T: Sync,
Create a BindTakeRef
binder, which gives &'static T
to a bound
function.
sourcepub const fn take_mut(&self) -> BindTakeMut<'pool, System, T>where
T: Send,
pub const fn take_mut(&self) -> BindTakeMut<'pool, System, T>where T: Send,
Create a BindTakeMut
binder, which gives &'static mut T
to a
bound function.
sourcepub const fn as_ref(&self) -> BindRef<System, T>where
T: Sync,
pub const fn as_ref(&self) -> BindRef<System, T>where T: Sync,
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.
source§impl<'pool, System, T> Bind<'pool, System, T>
impl<'pool, System, T> Bind<'pool, System, T>
sourcepub const fn hunk(&self) -> Hunk<System, BindData<T>>
pub const fn hunk(&self) -> Hunk<System, BindData<T>>
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
.