[][src]Enum wlambda::vval::VVal

pub enum VVal {
    Nul,
    Err(Rc<RefCell<(VVal, SynPos)>>),
    Bol(bool),
    Sym(String),
    Str(Rc<RefCell<String>>),
    Byt(Rc<RefCell<Vec<u8>>>),
    Int(i64),
    Flt(f64),
    Syn(SynPos),
    Lst(Rc<RefCell<Vec<VVal>>>),
    Map(Rc<RefCell<HashMap<String, VVal>>>),
    Fun(Rc<VValFun>),
    DropFun(Rc<DropVVal>),
    Ref(Rc<RefCell<VVal>>),
    CRef(Rc<RefCell<VVal>>),
    WWRef(Weak<RefCell<VVal>>),
    Usr(Box<dyn VValUserData>),
}

VVal aka. VariantValue is a data structure to represent all kinds of WLambda data structures.

It's used for the AST, for internal data and for runtime data structures.

Variants

Nul

The none value, the default value of all non initialized data.

The err value is a special sentinel value for representing any kind of application error condition. It's created using the special $e or $error syntax.

Bol(bool)

Representation of a boolean value.

Sym(String)

Representation of a symbol or key.

This one might be interned at some point, so that it only contains an Rc in future.

Representation of a unicode/text string.

Byt(Rc<RefCell<Vec<u8>>>)

Representation of a byte buffer.

Int(i64)

Integer value

Flt(f64)

Float value

Syn(SynPos)

A syntax node in the AST, records the position too.

Lst(Rc<RefCell<Vec<VVal>>>)

A list (or vector) of VVals.

A mapping of strings to VVals.

Fun(Rc<VValFun>)

A function, see also VValFun

DropFun(Rc<DropVVal>)

A guarded VVal, that executes a given function when it is no longer referenced.

Ref(Rc<RefCell<VVal>>)

A (strong) reference to a VVal.

CRef(Rc<RefCell<VVal>>)

A (still strong) reference to a VVal, which becomes a weak reference if captured by a closure.

WWRef(Weak<RefCell<VVal>>)

A (weak) reference to a VVal. Might turn VVal::Nul anytime.

Usr(Box<dyn VValUserData>)

A vval that can box some user data which can later be accessed from inside user supplied Rust functions via std::any::Any.

Methods

impl VVal[src]

pub fn new_str(s: &str) -> VVal[src]

pub fn new_str_mv(s: String) -> VVal[src]

pub fn new_sym(s: &str) -> VVal[src]

pub fn new_byt(v: Vec<u8>) -> VVal[src]

pub fn err(v: VVal, pos: SynPos) -> VVal[src]

pub fn err_msg(s: &str) -> VVal[src]

pub fn vec() -> VVal[src]

pub fn to_vec(&self) -> Vec<VVal>[src]

pub fn vec_from(vl: &[VVal]) -> VVal[src]

pub fn vec_mv(v: Vec<VVal>) -> VVal[src]

pub fn call(&self, env: &mut Env, args: &[VVal]) -> Result<VVal, StackAction>[src]

pub fn call_no_args(&self, env: &mut Env) -> Result<VVal, StackAction>[src]

pub fn call_internal(
    &self,
    env: &mut Env,
    argc: usize
) -> Result<VVal, StackAction>
[src]

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

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

pub fn set_ref(&self, v: VVal) -> VVal[src]

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

pub fn downgrade(self) -> VVal[src]

pub fn map() -> VVal[src]

pub fn sym(s: &str) -> VVal[src]

pub fn ref_id(&self) -> Option<i64>[src]

pub fn eqv(&self, v: &VVal) -> bool[src]

pub fn map_ok_skip<T, R>(&self, op: T, skip: usize) -> Vec<R> where
    T: FnMut(&VVal) -> R, 
[src]

pub fn map_skip<R, E, T>(&self, op: T, skip: usize) -> Result<Vec<R>, E> where
    T: FnMut(&VVal) -> Result<R, E>, 
[src]

pub fn unshift(&self, val: VVal) -> &VVal[src]

pub fn insert_at(&self, index: usize, val: VVal)[src]

pub fn set_at(&self, index: usize, val: VVal)[src]

pub fn at(&self, index: usize) -> Option<VVal>[src]

pub fn get_key(&self, key: &str) -> Option<VVal>[src]

pub fn set_map_key(&self, key: String, val: VVal)[src]

pub fn set_key(&self, key: &VVal, val: VVal)[src]

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

pub fn push(&self, val: VVal) -> &VVal[src]

pub fn is_empty(&self) -> bool[src]

pub fn len(&self) -> usize[src]

pub fn s_len(&self) -> usize[src]

pub fn s_raw(&self) -> String[src]

pub fn is_float(&self) -> bool[src]

pub fn is_int(&self) -> bool[src]

pub fn is_sym(&self) -> bool[src]

pub fn is_syn(&self) -> bool[src]

pub fn get_syn_pos(&self) -> SynPos[src]

pub fn get_syn(&self) -> Syntax[src]

pub fn to_compile_err(&self, msg: String) -> Result<EvalNode, CompileError>[src]

pub fn is_ref(&self) -> bool[src]

pub fn is_wref(&self) -> bool[src]

pub fn is_bool(&self) -> bool[src]

pub fn is_bytes(&self) -> bool[src]

pub fn is_str(&self) -> bool[src]

pub fn is_fun(&self) -> bool[src]

pub fn is_vec(&self) -> bool[src]

pub fn is_map(&self) -> bool[src]

pub fn is_none(&self) -> bool[src]

pub fn is_err(&self) -> bool[src]

pub fn type_name(&self) -> String[src]

pub fn f(&self) -> f64[src]

pub fn i(&self) -> i64[src]

pub fn b(&self) -> bool[src]

pub fn s(&self) -> String[src]

pub fn to_msgpack(&self) -> Result<Vec<u8>, String>[src]

Serializes the VVal (non cyclic) structure to a msgpack byte vector.

pub fn from_msgpack(s: &[u8]) -> Result<VVal, String>[src]

Creates a VVal structure from a msgpack byte vector.

pub fn to_json(&self, not_pretty: bool) -> Result<String, String>[src]

Serializes the VVal (non cyclic) structure to a JSON string.

pub fn from_json(s: &str) -> Result<VVal, String>[src]

Creates a VVal structure from a JSON string.

Trait Implementations

impl Clone for VVal[src]

impl Debug for VVal[src]

impl Serialize for VVal[src]

impl<'de> Deserialize<'de> for VVal[src]

Auto Trait Implementations

impl !Send for VVal

impl !Sync for VVal

impl Unpin for VVal

impl !UnwindSafe for VVal

impl !RefUnwindSafe for VVal

Blanket Implementations

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

impl<T> From<T> for 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.

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

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

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

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]