[−][src]Struct loom::sync::CausalCell
CausalCell ensures access to the inner value are valid under the Rust memory model.
Methods
impl<T> CausalCell<T>
[src]
pub fn new(data: T) -> CausalCell<T>
[src]
Construct a new instance of CausalCell
which will wrap the specified
value.
pub fn with<F, R>(&self, f: F) -> R where
F: FnOnce(*const T) -> R,
[src]
F: FnOnce(*const T) -> R,
Get an immutable pointer to the wrapped value.
Panics
This function will panic if the access is not valid under the Rust memory model.
pub fn with_deferred<F, R>(&self, f: F) -> (R, CausalCheck) where
F: FnOnce(*const T) -> R,
[src]
F: FnOnce(*const T) -> R,
Get an immutable pointer to the wrapped value, deferring the causality check.
Panics
This function will panic if the access is not valid under the Rust memory model.
pub fn with_mut<F, R>(&self, f: F) -> R where
F: FnOnce(*mut T) -> R,
[src]
F: FnOnce(*mut T) -> R,
Get a mutable pointer to the wrapped value.
Panics
This function will panic if the access is not valid under the Rust memory model.
pub fn with_deferred_mut<F, R>(&self, f: F) -> (R, CausalCheck) where
F: FnOnce(*mut T) -> R,
[src]
F: FnOnce(*mut T) -> R,
Get a mutable pointer to the wrapped value.
Panics
This function will panic if the access is not valid under the Rust memory model.
pub fn with_unchecked<F, R>(&self, f: F) -> R where
F: FnOnce(*const T) -> R,
[src]
F: FnOnce(*const T) -> R,
Get an immutable pointer to the wrapped value.
pub fn with_mut_unchecked<F, R>(&self, f: F) -> R where
F: FnOnce(*mut T) -> R,
[src]
F: FnOnce(*mut T) -> R,
Get a mutable pointer to the wrapped value.
pub fn check(&self)
[src]
Check that the current thread can make an immutable access without violating the Rust memory model.
Specifically, this function checks that there is no concurrent mutable access with this immutable access, while allowing many concurrent immutable accesses.
pub fn check_mut(&self)
[src]
Check that the current thread can make a mutable access without violating the Rust memory model.
Specifically, this function checks that there is no concurrent mutable access and no concurrent immutable access(es) with this mutable access.
Trait Implementations
Auto Trait Implementations
impl<T> Send for CausalCell<T> where
T: Send,
T: Send,
impl<T> !Sync for CausalCell<T>
impl<T> Unpin for CausalCell<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for CausalCell<T> where
T: UnwindSafe,
T: UnwindSafe,
impl<T> !RefUnwindSafe for CausalCell<T>
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,