pub struct AtomicAVal(/* private fields */);
Expand description
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<RwLockstd: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§
Trait Implementations§
Source§impl Clone for AtomicAVal
impl Clone for AtomicAVal
Source§fn clone(&self) -> AtomicAVal
fn clone(&self) -> AtomicAVal
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for AtomicAVal
impl Debug for AtomicAVal
Source§impl Default for AtomicAVal
impl Default for AtomicAVal
Source§impl VValUserData for AtomicAVal
impl VValUserData for AtomicAVal
Source§fn as_any(&mut self) -> &mut dyn Any
fn as_any(&mut self) -> &mut dyn Any
This should be implemented simply by returning
a mutable reference to the concrete type self.
It allows you to access your data structure from inside
a function yourself. Read more
Source§fn call_method(&self, key: &str, env: &mut Env) -> Result<VVal, StackAction>
fn call_method(&self, key: &str, env: &mut Env) -> Result<VVal, StackAction>
This method is called, when the user data object is used in a method call directly.
Use this to implement convenient APIs for the user of the user data object.
To quickly get the arguments you may use
env.argv_ref()
.Source§fn clone_ud(&self) -> Box<dyn VValUserData>
fn clone_ud(&self) -> Box<dyn VValUserData>
Should clone your user data instance. Whether you are doing
a deep clone or a shallow clone or something else is up to you.
Source§fn s(&self) -> String
fn s(&self) -> String
This method should return a human readable syntax representation
of your VValUserData.
Source§fn s_raw(&self) -> String
fn s_raw(&self) -> String
If your data has a plain string representation,
you can return the string directly from here.
Source§fn b(&self) -> bool
fn b(&self) -> bool
Returns the boolean representation of your data. Can for instance
be used to check if your data is valid or something.
Source§fn eqv(&self, _other: &Box<dyn VValUserData>) -> bool
fn eqv(&self, _other: &Box<dyn VValUserData>) -> bool
Allows you to specify how two instances of your data
should be compared for equivalentness.
Source§fn set_key(&self, _key: &VVal, _val: VVal) -> Result<(), StackAction>
fn set_key(&self, _key: &VVal, _val: VVal) -> Result<(), StackAction>
Makes your user data act like a map. This can be useful
for implementing your own registries or data structures.
Implement this method for setting a key to a value.
Source§fn delete_key(&self, _key: &VVal) -> Result<VVal, StackAction>
fn delete_key(&self, _key: &VVal) -> Result<VVal, StackAction>
This method is called when the user wants to remove a key.
Typically called when
std:delete
from the prelude is called.Source§fn get_key(&self, _key: &str) -> Option<VVal>
fn get_key(&self, _key: &str) -> Option<VVal>
This method returns some value that your user data
associates with the given key.
Source§fn call(&self, _env: &mut Env) -> Result<VVal, StackAction>
fn call(&self, _env: &mut Env) -> Result<VVal, StackAction>
This method is called when the user data is called.
To quickly get the arguments you may use
env.argv_ref()
.Source§fn as_thread_safe_usr(&mut self) -> Option<Box<dyn ThreadSafeUsr>>
fn as_thread_safe_usr(&mut self) -> Option<Box<dyn ThreadSafeUsr>>
This function is called when you try to pass a user data value
between threads via the Atoms provided by the thread implementation
of WLambda. Read more
Auto Trait Implementations§
impl Freeze for AtomicAVal
impl RefUnwindSafe for AtomicAVal
impl Send for AtomicAVal
impl Sync for AtomicAVal
impl Unpin for AtomicAVal
impl UnwindSafe for AtomicAVal
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more