Struct wayland_commons::ThreadGuard[][src]

pub struct ThreadGuard<T: ?Sized> { /* fields omitted */ }

Stores a value in a threadafe container that only lets you access it from its owning thread

If the ThreadGuard is dropped from the wrong thread, the underlying value will be leaked.

Implementations

impl<T> ThreadGuard<T>[src]

pub fn new(val: T) -> ThreadGuard<T>[src]

Create a new ThreadGuard wrapper

impl<T: ?Sized> ThreadGuard<T>[src]

pub fn get(&self) -> &T[src]

Access the underlying value

Panics if done on the wrong thread

pub fn get_mut(&mut self) -> &mut T[src]

Mutably access the underlying value

Panics if done on the wrong thread

pub fn try_get(&self) -> Option<&T>[src]

Try to access the underlying value

Returns None if done on the wrong thread

pub fn try_get_mut(&mut self) -> Option<&mut T>[src]

Try to mutably access the underlying value

Returns None if done on the wrong thread

Trait Implementations

impl<T: ?Sized> Drop for ThreadGuard<T>[src]

impl<T: ?Sized> Send for ThreadGuard<T>[src]

impl<T: ?Sized> Sync for ThreadGuard<T>[src]

Auto Trait Implementations

impl<T: ?Sized> RefUnwindSafe for ThreadGuard<T> where
    T: RefUnwindSafe

impl<T: ?Sized> Unpin for ThreadGuard<T> where
    T: Unpin

impl<T: ?Sized> UnwindSafe for ThreadGuard<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.