Trait ManagerRef

Source
pub trait ManagerRef:
    Clone
    + Eq
    + Hash
    + for<'a, 'id> From<&'a Self::Manager<'id>> {
    type Manager<'id>: Manager;

    // Required methods
    fn with_manager_shared<F, T>(&self, f: F) -> T
       where F: for<'id> FnOnce(&Self::Manager<'id>) -> T;
    fn with_manager_exclusive<F, T>(&self, f: F) -> T
       where F: for<'id> FnOnce(&mut Self::Manager<'id>) -> T;
}
Expand description

Manager reference

The methods of this trait synchronize accesses to the manager: In a concurrent setting, a manager has some kind of read/write lock, and Self::with_manager_shared() / Self::with_manager_exclusive() acquire this lock accordingly. In a sequential implementation, a RefCell or the like may be used instead of lock.

Required Associated Types§

Source

type Manager<'id>: Manager

Type of the associated manager

For more details on why this type is generic over 'id, see the documentation of Function::Manager.

Required Methods§

Source

fn with_manager_shared<F, T>(&self, f: F) -> T
where F: for<'id> FnOnce(&Self::Manager<'id>) -> T,

Obtain a shared manager reference

Locking behavior: acquires the manager’s lock for shared access.

Source

fn with_manager_exclusive<F, T>(&self, f: F) -> T
where F: for<'id> FnOnce(&mut Self::Manager<'id>) -> T,

Obtain an exclusive manager reference

Locking behavior: acquires the manager’s lock for exclusive access.

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§