Struct r3::sync::recursive_mutex::Definer
source · pub struct Definer<System, Source> { /* private fields */ }
sync
only.Expand description
The definer (static builder) for StaticRecursiveMutex
.
Implementations§
source§impl<System, Source> Definer<System, Source>where
System: KernelMutex + KernelStatic,
impl<System, Source> Definer<System, Source>where System: KernelMutex + KernelStatic,
sourcepub const fn protocol(self, protocol: MutexProtocol) -> Self
pub const fn protocol(self, protocol: MutexProtocol) -> Self
Specify the mutex’s protocol. Defaults to None
when unspecified.
source§impl<System, T> Definer<System, DefaultSource<MutexInner<T>>>where
T: 'static,
impl<System, T> Definer<System, DefaultSource<MutexInner<T>>>where T: 'static,
Initial Value
The following methods specify the initial value for the contained
object (T
).
If none of the following methods are called, T
will be constructed
by its Default
implementation.
sourcepub const fn init<Func>(
self,
func: Func
) -> Definer<System, NewBindSource<(), FnBindMap<Func, impl FnOnce(T) -> MutexInner<T> + Send + Copy + 'static>>>where
NewBindSource<(), FnBindMap<Func, impl FnOnce(T) -> MutexInner<T> + Send + Copy + 'static>>: Source<System, Target = MutexInner<T>>,
pub const fn init<Func>( self, func: Func ) -> Definer<System, NewBindSource<(), FnBindMap<Func, impl FnOnce(T) -> MutexInner<T> + Send + Copy + 'static>>>where NewBindSource<(), FnBindMap<Func, impl FnOnce(T) -> MutexInner<T> + Send + Copy + 'static>>: Source<System, Target = MutexInner<T>>,
Use the specified function to provide the initial value.
The semantics of the method’s parameter is similar to that of
BindDefiner::init
.
sourcepub const fn init_with_bind<Binder, Func>(
self,
binder: Binder,
func: Func
) -> Definer<System, NewBindSource<Binder, FnBindMap<Func, impl FnOnce(T) -> MutexInner<T> + Send + Copy + 'static>>>where
NewBindSource<Binder, FnBindMap<Func, impl FnOnce(T) -> MutexInner<T> + Send + Copy + 'static>>: Source<System, Target = MutexInner<T>>,
pub const fn init_with_bind<Binder, Func>( self, binder: Binder, func: Func ) -> Definer<System, NewBindSource<Binder, FnBindMap<Func, impl FnOnce(T) -> MutexInner<T> + Send + Copy + 'static>>>where NewBindSource<Binder, FnBindMap<Func, impl FnOnce(T) -> MutexInner<T> + Send + Copy + 'static>>: Source<System, Target = MutexInner<T>>,
Use the specified function with dependency to provide the initial value.
The semantics of the method’s parameters is similar to that of
BindDefiner::init_with_bind
.
sourcepub const fn take_bind<'pool>(
self,
bind: Bind<'pool, System, MutexInner<T>>
) -> Definer<System, TakeBindSource<'pool, System, MutexInner<T>>>
pub const fn take_bind<'pool>( self, bind: Bind<'pool, System, MutexInner<T>> ) -> Definer<System, TakeBindSource<'pool, System, MutexInner<T>>>
Take the specified binding to use as this object’s contents.
Warning: Unlike
mutex::Definer::take_bind
, this method expects thatT
is already wrapped byMutexInner
in the specified binding.
sourcepub const unsafe fn wrap_hunk_unchecked(
self,
hunk: Hunk<System, UnsafeCell<MaybeUninit<MutexInner<T>>>>
) -> Definer<System, HunkSource<System, MutexInner<T>>>
pub const unsafe fn wrap_hunk_unchecked( self, hunk: Hunk<System, UnsafeCell<MaybeUninit<MutexInner<T>>>> ) -> Definer<System, HunkSource<System, MutexInner<T>>>
Use the specified existing hunk as this object’s storage.
Warning: Unlike
mutex::Definer::wrap_hunk_unchecked
, this method expects thatT
is already wrapped byMutexInner
in the specified binding. A care must be taken not to accidentally transmuteT
intoMutexInner<T>
when passing a hunk that has the same representation asT
but requires transmutation due to having a different set of wrappers, such asMaybeUninit
andUnsafeCell
.
Safety
This object grants exclusive access (&mut T
) to the
UnsafeCell
’s contents based on the assumption that no accesses
are made through other means, and that T
is initialized by
the time the boot phase completes.
source§impl<System, Source> Definer<System, Source>where
System: KernelMutex + KernelStatic,
impl<System, Source> Definer<System, Source>where System: KernelMutex + KernelStatic,
sourcepub const fn finish<C: CfgMutex<System = System>, T>(
self,
cfg: &mut Cfg<'_, C>
) -> StaticRecursiveMutex<System, T>where
Source: Source<System, Target = MutexInner<T>>,
pub const fn finish<C: CfgMutex<System = System>, T>( self, cfg: &mut Cfg<'_, C> ) -> StaticRecursiveMutex<System, T>where Source: Source<System, Target = MutexInner<T>>,
Complete the definition of a mutex, returning a reference to the mutex.