[][src]Struct wlambda::threads::AtomicAVal

pub struct AtomicAVal(_);

WLambda:

!atom = std:sync:atom:new 10;
!channel = std:sync:mpsc:new[];
!thrd = std:spawn_thread $q{
    !val = main.read;
    main.write $[1,$[0,1],3];

    main.read_at 0;
    main.write_at $[1, 0] 320;
    q.send $["done", 10];

} ${ main = atom, q = channel };

!item = queue.pop[];
.item = queue.pop_timeout 1000;


Wraps an AVal like this: Arc<RwLock>. An AtomicAVal is a thread safe container for VVal data structures. It's used by WLambda functions like std:sync:atom:new, std:sync:atom:read or std:sync:atom:write.

These containers are shared between the threads by passing them to the threads at std:thread:spawn.

Implementations

impl AtomicAVal[src]

pub fn new() -> Self[src]

Creates a new empty instance, containing AVal::None.

pub fn write(&self, vv: &VVal) -> VVal[src]

Locks and stores the VVal.

pub fn swap(&self, vv: &VVal) -> VVal[src]

Locks and stores the VVal.

pub fn read(&self) -> VVal[src]

Locks and reads the AVal and converts it to a VVal.

pub fn store_at(&self, _keypath: &VVal, vv: &VVal)[src]

Locks and stores the VVal at the given key path.

pub fn read_at(&self, _keypath: &VVal) -> VVal[src]

Locks and reads the AVal at the given key path.

Trait Implementations

impl Clone for AtomicAVal[src]

impl Debug for AtomicAVal[src]

impl Default for AtomicAVal[src]

impl VValUserData for AtomicAVal[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.