pub struct Definer<System, Source> { /* private fields */ }
sync
only.Expand description
The definer (static builder) for StaticMutex
.
Implementations§
source§impl<System, Source> Definer<System, Source>where
System: KernelMutex,
impl<System, Source> Definer<System, Source>where System: KernelMutex,
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<T>>where
T: 'static,
impl<System, T> Definer<System, DefaultSource<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<(), Func>>where
NewBindSource<(), Func>: Source<System, Target = T>,
pub const fn init<Func>( self, func: Func ) -> Definer<System, NewBindSource<(), Func>>where NewBindSource<(), Func>: Source<System, Target = 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, Func>>where
NewBindSource<Binder, Func>: Source<System, Target = T>,
pub const fn init_with_bind<Binder, Func>( self, binder: Binder, func: Func ) -> Definer<System, NewBindSource<Binder, Func>>where NewBindSource<Binder, Func>: Source<System, Target = 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, T>
) -> Definer<System, TakeBindSource<'pool, System, T>>
pub const fn take_bind<'pool>( self, bind: Bind<'pool, System, T> ) -> Definer<System, TakeBindSource<'pool, System, T>>
Take the specified binding to use as this object’s contents.
sourcepub const unsafe fn wrap_hunk_unchecked(
self,
hunk: Hunk<System, UnsafeCell<MaybeUninit<T>>>
) -> Definer<System, HunkSource<System, T>>
pub const unsafe fn wrap_hunk_unchecked( self, hunk: Hunk<System, UnsafeCell<MaybeUninit<T>>> ) -> Definer<System, HunkSource<System, T>>
Use the specified existing hunk as this object’s storage.
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,
Finalization
The following method completes the definition of a mutex.