Trait Mutex

Source
pub unsafe trait Mutex:
    'static
    + Sync
    + Send {
    type Guard<'a>;

    // Required methods
    unsafe fn new(ptr: *mut Self);
    unsafe fn lock(&self) -> Self::Guard<'_>;
}
Expand description

§Safety

The implementation must make sure the functions in the trait behave properly.

Required Associated Types§

Source

type Guard<'a>

Required Methods§

Source

unsafe fn new(ptr: *mut Self)

Creates a mutex.

§Safety

The mutex must not be moved until dropped. The mutex must not be initialized.

Source

unsafe fn lock(&self) -> Self::Guard<'_>

Lock a mutex.

§Safety

The mutex must not be moved until dropped. The mutex must be initialized.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§