Struct shareable::SharedIsize [] [src]

pub struct SharedIsize {
    // some fields omitted
}

Shareable isize data element.

Examples

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

// Multiple threads, atomic values are used.
let value1 = SharedIsize::new(63);
let value2 = value1.clone();

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

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

value1.set(31);

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

Methods

impl SharedIsize
[src]

fn new(value: isize) -> SharedIsize

Construct a new instance of the object.

fn set(&self, value: isize)

Set the value of the object.

fn get(&self) -> isize

Returns the value of the object.

Trait Implementations

impl Clone for SharedIsize
[src]

fn clone(&self) -> SharedIsize

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

impl Debug for SharedIsize
[src]

fn fmt(&self, f: &mut Formatter) -> Result<()Error>

Implementation of Debug.

impl Display for SharedIsize
[src]

fn fmt(&self, f: &mut Formatter) -> Result<()Error>

Implementation of Display.