Struct shareable::SharedF32 [] [src]

pub struct SharedF32 { /* fields omitted */ }

Stores a f32 element inside an atomic element so it can be accessed by multiple threads.

Examples

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

let value1 = SharedF32::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 SharedF32
[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 SharedF32
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Debug for SharedF32
[src]

Implementation of Debug.

impl Display for SharedF32
[src]

Implementation of Display.