RawOsMutex

Struct RawOsMutex 

Source
pub struct RawOsMutex<T: UnsafeRawOsMutex> { /* private fields */ }
Expand description

Platform mutex primitives for use with [Mutex] and [MutexWrap].

While the std::sync::Mutex type only uses one kind of platform mutex primitive (except on Windows, where things are a little convoluted), flexible-locks allow to use different kinds.

The available primitives are:

Other primitives could be added in the future, such as os_unfair_lock_t on macOS.

For types that can be statically initialized, until const fn is stabilized, initializer macros are provided:

For non-static initialization, Default::default() can be used for these.

For more specific non default use cases, you may want to implement your own type and implement the RawMutex or UnsafeRawOsMutex trait for it.

§Safety

Generally speaking, platform mutex primitives cannot be moved in memory. That is, they must stay at the same address. Please ensure that is the case when you use them.

Trait Implementations§

Source§

impl<T: UnsafeRawOsMutex> RawMutex for RawOsMutex<T>

Source§

unsafe fn init(&mut self)

Initialize the raw mutex. Read more
Source§

unsafe fn lock(&self)

Acquire the raw mutex.
Source§

unsafe fn unlock(&self)

Release the raw mutex.
Source§

unsafe fn destroy(&self)

Destroy the raw mutex. Read more
Source§

impl<T: UnsafeRawOsMutex> Send for RawOsMutex<T>

Source§

impl<T: UnsafeRawOsMutex> Sync for RawOsMutex<T>

Auto Trait Implementations§

§

impl<T> !Freeze for RawOsMutex<T>

§

impl<T> !RefUnwindSafe for RawOsMutex<T>

§

impl<T> Unpin for RawOsMutex<T>
where T: Unpin,

§

impl<T> UnwindSafe for RawOsMutex<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

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 T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.