Struct shareable::SharedF64 [] [src]

pub struct SharedF64 { /* fields omitted */ }

Shareable f64 data element.

If the architecture is 64 bit then the value is saved in an atomic otherwise a mutex is used.

Examples

use std::sync::mpsc;
use std::thread;
use shareable::SharedF64;

let value1 = SharedF64::new(63.23);
let value2 = value1.clone();

let (tx, rx) = mpsc::channel();

let thread = thread::spawn(move || {
    rx.recv();
    assert_eq!(value2.get(), 31.83);
});

value1.set(31.83);

tx.send(());
thread.join().unwrap();

Methods

impl SharedF64
[src]

Construct a new instance of the object.

Set the value of the object.

Returns the value of the object.

Trait Implementations

impl Clone for SharedF64
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Debug for SharedF64
[src]

Implementation of Debug.

impl Display for SharedF64
[src]

Implementation of Display.