oxidd_core

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.

Object Safety§

This trait is not object safe.

Implementors§