[go: up one dir, main page]

Gutex

Struct Gutex 

Source
pub struct Gutex<T> { /* private fields */ }
Expand description

Member of a GutexGroup.

Either lock on this type will lock the same mutex in the group. Lock on the group always grant an exclusive access to the whole group. Let’s say thread A call Gutex::read() then thread B try to call this method on the same group. The result is thread B will wait for thread A to unlock the group.

Implementations§

Source§

impl<T> Gutex<T>

Source

pub fn get_mut(&mut self) -> &mut T

Returns a mutable reference to the underlying data.

Source

pub fn read(&self) -> GutexReadGuard<'_, T>

Locks this Gutex with read-only access.

Multiple read-only accesses can be taken out at the same time.

§Panics

If there are an active write access to this Gutex.

Source

pub fn write(&self) -> GutexWriteGuard<'_, T>

Locks this Gutex with write access.

§Panics

If there are any active reader or writer.

Trait Implementations§

Source§

impl<T: Debug> Debug for Gutex<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Send> Send for Gutex<T>

Source§

impl<T: Send> Sync for Gutex<T>

Auto Trait Implementations§

§

impl<T> !Freeze for Gutex<T>

§

impl<T> !RefUnwindSafe for Gutex<T>

§

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

§

impl<T> !UnwindSafe for Gutex<T>

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.