Struct rustc_data_structures::ivar::Ivar
[−]
[src]
pub struct Ivar<T: Copy> {
// some fields omitted
}Unstable (
rustc_private)A write-once variable. When constructed, it is empty, and can only be set once.
Ivars ensure that data that can only be initialised once. A full
implementation is used for concurrency and blocks on a read of an
unfulfilled value. This implementation is more minimal and panics
if you attempt to read the value before it has been set. It is also
not Sync, but may be extended in the future to be usable as a true
concurrency type.
The T: Copy bound is not strictly needed, but it is required by
Cell (so removing it would require using UnsafeCell), and it
suffices for the current purposes.
Methods
impl<T: Copy> Ivar<T>[src]
fn new() -> Ivar<T>
fn get(&self) -> Option<T>
fn fulfill(&self, value: T)
fn is_fulfilled(&self) -> bool
fn unwrap(&self) -> T
Trait Implementations
impl<T: Copy + Debug> Debug for Ivar<T>[src]
impl<T: Copy> Clone for Ivar<T>[src]
fn clone(&self) -> Ivar<T>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0
Performs copy-assignment from source. Read more