Skip to main content

Expr

Enum Expr 

Source
pub enum Expr {
Show 20 variants Nil, T, Number(Number), String(String), Symbol(String), Keyword(String), Bytes(Vec<u8>), Cons(Box<Expr>, Box<Expr>), List(Vec<Expr>), Quote(Box<Expr>), Datum(Box<Expr>), Quasiquote(Box<Expr>), Unquote(Box<Expr>), UnquoteSplicing(Box<Expr>), Lambda(LambdaParams, Box<Expr>), RuntimeValue(Value), WasmRuntime(WasmType), WasmLocal(u32, WasmType), WasmGlobal(u32, WasmType), Instance(u32, StructId),
}

Variants§

§

Nil

§

T

§

Number(Number)

§

String(String)

§

Symbol(String)

§

Keyword(String)

§

Bytes(Vec<u8>)

§

Cons(Box<Expr>, Box<Expr>)

§

List(Vec<Expr>)

§

Quote(Box<Expr>)

§

Datum(Box<Expr>)

An evaluated value that is the datum inside; the reader never makes it.

§

Quasiquote(Box<Expr>)

§

Unquote(Box<Expr>)

§

UnquoteSplicing(Box<Expr>)

§

Lambda(LambdaParams, Box<Expr>)

§

RuntimeValue(Value)

§

WasmRuntime(WasmType)

§

WasmLocal(u32, WasmType)

Value stored in WASM local variable (index, type)

§

WasmGlobal(u32, WasmType)

Value stored in a mutable module global (index, type)

§

Instance(u32, StructId)

A session struct instance an earlier unit left (serial, layout): a leaf the unit’s prologue binds to a module global; it never folds.

Implementations§

Source§

impl Expr

Source

pub fn cons(car: Expr, cdr: Expr) -> Self

Source

pub fn symbol(name: &str) -> Self

Source

pub fn body(forms: &[Expr]) -> Self

A body of forms as one form: the sole form, else a PROGN.

Source

pub fn wasm_type(&self) -> Option<WasmType>

Returns the WasmType if this expression is a runtime value.

Source

pub fn is_wasm_runtime(&self) -> bool

True if this is a runtime value.

Source

pub fn is_runtime_variable(&self) -> bool

True for a runtime placeholder, local or global, which means nothing outside the function that resolved it; a session instance does.

Source

pub fn any_form(&self, test: impl Fn(&Expr) -> bool) -> bool

Whether test holds of the form or of any form inside it. Walked with an explicit stack, so a deep form cannot overflow.

Source

pub fn place(&self) -> Option<(Place, WasmType)>

The storage and type of a runtime variable; None for a placeholder or a compile-time value.

Source

pub fn is_function_value(&self) -> bool

Whether the value is a function: a lambda or a closure place.

Source§

impl Expr

Source

pub fn is_nil(&self) -> bool

The single compile-time truth test: a value is false exactly when it is nil.

Source

pub fn is_atom(&self) -> bool

Source

pub fn as_symbol(&self) -> Option<&str>

Source

pub fn as_list(&self) -> Option<&[Expr]>

The elements of a list; nil is the empty list.

Source

pub fn symbol_parts(&self) -> Option<(Option<&str>, &str)>

Splits a Symbol into (namespace, name). A qualified symbol is stored canonically as NS:NAME (ADR-0029); an unqualified one has no : and yields (None, name). Non-symbols yield None. The split is on the single canonical : — NS::NAME was already folded to NS:NAME by the reader, so at most one : is ever present here.

Source§

impl Expr

Source

pub fn quoted(datum: Expr) -> Self

The one constructor for a value that is a datum (a 'x datum is the list (QUOTE x)): nil, t, the empty list, numbers, strings and keywords are the values themselves, anything else is wrapped in Datum. A list datum holds its 'x members as the lists (QUOTE x), at every depth.

Source

pub fn quoted_code(code: Expr) -> Self

The code form 'x, as the reader makes it: the expression is code, whose 'x members stay quotes.

Source

pub fn into_code(self) -> Self

A computed value where code is wanted: a datum is the form it holds, the exact inverse of Expr::into_data, any other value is itself.

Source

pub fn into_data(self) -> Self

The datum of a quoted list: a 'x member is the list (QUOTE x), at every depth. The outermost expression is not wrapped.

Source

pub fn into_datum_member(self) -> Self

A value as a member of list data: its Datum wrapper goes and a quote is the list (QUOTE x), at every depth.

Source

pub fn exact_number(&self) -> Option<Ratio<i64>>

The exact value of a numeric constant, whatever its dimension.

Source

pub fn quoted_list(items: Vec<Expr>) -> Self

Source§

impl Expr

Source

pub fn unquoted_forms(&self) -> Vec<&Expr>

The forms the quasiquote template self runs: its unquotes and unquote-splicings at the template’s own depth, in order.

Source

pub fn map_unquoted( &self, rewrite: &mut impl FnMut(&Expr) -> Result<Expr>, ) -> Result<Expr>

The template self with each of its Self::unquoted_forms replaced by rewrite of it.

Trait Implementations§

Source§

impl Clone for Expr

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Expr

Source§

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

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Expr

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Expr

Auto Trait Implementations§

§

impl Freeze for Expr

§

impl RefUnwindSafe for Expr

§

impl Send for Expr

§

impl Sync for Expr

§

impl Unpin for Expr

§

impl UnsafeUnpin for Expr

§

impl UnwindSafe for Expr

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more