pub struct Definer<System, Source> { /* private fields */ }
Available on crate feature sync only.
Expand description

The definer (static builder) for StaticRecursiveMutex.

Implementations§

source§

impl<System, Source> Definer<System, Source>where System: KernelMutex + KernelStatic,

source

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,

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.

source

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.

source

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.

source

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 that T is already wrapped by MutexInner in the specified binding.

source

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 that T is already wrapped by MutexInner in the specified binding. A care must be taken not to accidentally transmute T into MutexInner<T> when passing a hunk that has the same representation as T but requires transmutation due to having a different set of wrappers, such as MaybeUninit and UnsafeCell.

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,

source

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.

Auto Trait Implementations§

§

impl<System, Source> RefUnwindSafe for Definer<System, Source>where Source: RefUnwindSafe,

§

impl<System, Source> Send for Definer<System, Source>where Source: Send,

§

impl<System, Source> Sync for Definer<System, Source>where Source: Sync,

§

impl<System, Source> Unpin for Definer<System, Source>where Source: Unpin,

§

impl<System, Source> UnwindSafe for Definer<System, Source>where Source: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.