Struct prusst::util::VolatileCell [] [src]

#[repr(C)]
pub struct VolatileCell<T> { /* fields omitted */ }

A convenient zero-overhead wrapper for volatile fields that implement Copy and Clone.

This allows writing and reading volatile fields without resorting to unsafe.

An important difference with another popular implementation of VolatileCell is that interior mutability is not allowed. Although it may at first appear logical to allow a volatile Send and Sync type to provide interior mutability arguing that the value may anyway be changed by another process, this may wrongly lead the user into believing that volatile values can be used used for inter-thread communication (see A. D. Robinson's essay: "Volatile: Almost Useless for Multi-Threaded Programming").

Methods

impl<T> VolatileCell<T>
[src]

[src]

Creates a new VolatileCell containing the given value.

[src]

Returns a copy of the contained value.

[src]

Sets the contained value.

Trait Implementations

impl<T: Copy> Copy for VolatileCell<T>
[src]

impl<T: Clone> Clone for VolatileCell<T>
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more