ThreadModelGuard

Trait ThreadModelGuard 

Source
pub trait ThreadModelGuard<T> {
    type Ref<'a, V>: Deref<Target = V>
       where Self: 'a,
             V: 'a;
    type RefMut<'a, V>: DerefMut<Target = V>
       where Self: 'a,
             V: 'a;

    // Required methods
    fn new(value: T) -> Self;
    fn get(&self) -> Self::Ref<'_, T>;
    fn get_mut(&self) -> Self::RefMut<'_, T>;
    fn is_multithread() -> bool;
}

Required Associated Types§

Source

type Ref<'a, V>: Deref<Target = V> where Self: 'a, V: 'a

Source

type RefMut<'a, V>: DerefMut<Target = V> where Self: 'a, V: 'a

Required Methods§

Source

fn new(value: T) -> Self

Source

fn get(&self) -> Self::Ref<'_, T>

Get immutable reference of type T

Source

fn get_mut(&self) -> Self::RefMut<'_, T>

Get mutable reference of type T

Source

fn is_multithread() -> bool

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§

Source§

impl<T> ThreadModelGuard<T> for MTModelHolder<T>

Source§

type Ref<'a, V> = MutexGuard<'a, V> where Self: 'a, V: 'a

Source§

type RefMut<'a, V> = MutexGuard<'a, V> where Self: 'a, V: 'a

Source§

impl<T> ThreadModelGuard<T> for STModelHolder<T>

Source§

type Ref<'a, V> = Ref<'a, V> where Self: 'a, V: 'a

Source§

type RefMut<'a, V> = RefMut<'a, V> where Self: 'a, V: 'a