Trait statime::PtpInstanceStateMutex
source · pub trait PtpInstanceStateMutex {
// Required methods
fn new(state: PtpInstanceState) -> Self;
fn with_ref<R, F: FnOnce(&PtpInstanceState) -> R>(&self, f: F) -> R;
fn with_mut<R, F: FnOnce(&mut PtpInstanceState) -> R>(&self, f: F) -> R;
}
Expand description
A mutex over a PtpInstanceState
This provides an abstraction for locking state in various environments.
Implementations are provided for core::cell::RefCell
and
std::sync::RwLock
.
Required Methods§
sourcefn new(state: PtpInstanceState) -> Self
fn new(state: PtpInstanceState) -> Self
Creates a new instance of the mutex
sourcefn with_ref<R, F: FnOnce(&PtpInstanceState) -> R>(&self, f: F) -> R
fn with_ref<R, F: FnOnce(&PtpInstanceState) -> R>(&self, f: F) -> R
Takes a shared reference to the contained state and calls f
with it
sourcefn with_mut<R, F: FnOnce(&mut PtpInstanceState) -> R>(&self, f: F) -> R
fn with_mut<R, F: FnOnce(&mut PtpInstanceState) -> R>(&self, f: F) -> R
Takes a mutable reference to the contained state and calls f
with it
Object Safety§
This trait is not object safe.