[][src]Struct wayland_commons::ThreadGuard

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

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

Methods

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> Send for ThreadGuard<T>[src]

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

Auto Trait Implementations

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

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

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

Blanket Implementations

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

impl<T> From<T> for 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.

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

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

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