Enum cl_interpret::convalue::ConValue

source ·
pub enum ConValue {
    Empty,
    Int(isize),
    Bool(bool),
    Char(char),
    String(Sym),
    Ref(Rc<ConValue>),
    Array(Rc<[ConValue]>),
    Tuple(Rc<[ConValue]>),
    RangeExc(isize, isize),
    RangeInc(isize, isize),
    Function(Function),
    BuiltIn(&'static dyn BuiltIn),
}
Expand description

A Conlang value stores data in the interpreter

Variants§

§

Empty

The empty/unit () type

§

Int(isize)

An integer

§

Bool(bool)

A boolean

§

Char(char)

A unicode character

§

String(Sym)

A string

§

Ref(Rc<ConValue>)

A reference

§

Array(Rc<[ConValue]>)

An Array

§

Tuple(Rc<[ConValue]>)

A tuple

§

RangeExc(isize, isize)

An exclusive range

§

RangeInc(isize, isize)

An inclusive range

§

Function(Function)

A callable thing

§

BuiltIn(&'static dyn BuiltIn)

A built-in function

Implementations§

source§

impl ConValue

source

pub fn truthy(&self) -> IResult<bool>

Gets whether the current value is true or false

source

pub fn range_exc(self, other: Self) -> IResult<Self>

source

pub fn range_inc(self, other: Self) -> IResult<Self>

source

pub fn index(&self, index: &Self) -> IResult<ConValue>

source

pub fn lt(&self, other: &Self) -> IResult<Self>

TODO: Remove when functions are implemented: Desugar into function calls

source

pub fn lt_eq(&self, other: &Self) -> IResult<Self>

TODO: Remove when functions are implemented: Desugar into function calls

source

pub fn eq(&self, other: &Self) -> IResult<Self>

TODO: Remove when functions are implemented: Desugar into function calls

source

pub fn neq(&self, other: &Self) -> IResult<Self>

TODO: Remove when functions are implemented: Desugar into function calls

source

pub fn gt_eq(&self, other: &Self) -> IResult<Self>

TODO: Remove when functions are implemented: Desugar into function calls

source

pub fn gt(&self, other: &Self) -> IResult<Self>

TODO: Remove when functions are implemented: Desugar into function calls

source

pub fn add_assign(&mut self, other: Self) -> IResult<()>

source

pub fn bitand_assign(&mut self, other: Self) -> IResult<()>

source

pub fn bitor_assign(&mut self, other: Self) -> IResult<()>

source

pub fn bitxor_assign(&mut self, other: Self) -> IResult<()>

source

pub fn div_assign(&mut self, other: Self) -> IResult<()>

source

pub fn mul_assign(&mut self, other: Self) -> IResult<()>

source

pub fn rem_assign(&mut self, other: Self) -> IResult<()>

source

pub fn shl_assign(&mut self, other: Self) -> IResult<()>

source

pub fn shr_assign(&mut self, other: Self) -> IResult<()>

source

pub fn sub_assign(&mut self, other: Self) -> IResult<()>

Trait Implementations§

source§

impl Add for ConValue

source§

fn add(self, rhs: Self) -> Self::Output

TODO: Desugar operators into function calls

§

type Output = Result<ConValue, Error>

The resulting type after applying the + operator.
source§

impl BitAnd for ConValue

source§

fn bitand(self, rhs: Self) -> Self::Output

TODO: Desugar operators into function calls

§

type Output = Result<ConValue, Error>

The resulting type after applying the & operator.
source§

impl BitOr for ConValue

source§

fn bitor(self, rhs: Self) -> Self::Output

TODO: Desugar operators into function calls

§

type Output = Result<ConValue, Error>

The resulting type after applying the | operator.
source§

impl BitXor for ConValue

source§

fn bitxor(self, rhs: Self) -> Self::Output

TODO: Desugar operators into function calls

§

type Output = Result<ConValue, Error>

The resulting type after applying the ^ operator.
source§

impl Callable for ConValue

source§

fn name(&self) -> Sym

Returns the common name of this identifier.
source§

fn call( &self, interpreter: &mut Environment, args: &[ConValue] ) -> IResult<ConValue>

Calls this Callable in the provided Environment, with ConValue args
The Callable is responsible for checking the argument count and validating types
source§

impl Clone for ConValue

source§

fn clone(&self) -> ConValue

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for ConValue

source§

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

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

impl Default for ConValue

source§

fn default() -> ConValue

Returns the “default value” for a type. Read more
source§

impl Display for ConValue

source§

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

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

impl Div for ConValue

source§

fn div(self, rhs: Self) -> Self::Output

TODO: Desugar operators into function calls

§

type Output = Result<ConValue, Error>

The resulting type after applying the / operator.
source§

impl From<&[ConValue]> for ConValue

source§

fn from(value: &[ConValue]) -> Self

Converts to this type from the input type.
source§

impl From<&Interned<'static, str>> for ConValue

source§

fn from(value: &Sym) -> Self

Converts to this type from the input type.
source§

impl From<&'static dyn BuiltIn> for ConValue

source§

fn from(value: &'static dyn BuiltIn) -> Self

Converts to this type from the input type.
source§

impl From<&str> for ConValue

source§

fn from(value: &str) -> Self

Converts to this type from the input type.
source§

impl From<()> for ConValue

source§

fn from(_: ()) -> Self

Converts to this type from the input type.
source§

impl From<Function> for ConValue

source§

fn from(value: Function) -> Self

Converts to this type from the input type.
source§

impl From<Interned<'static, str>> for ConValue

source§

fn from(value: Sym) -> Self

Converts to this type from the input type.
source§

impl From<Rc<str>> for ConValue

source§

fn from(value: Rc<str>) -> Self

Converts to this type from the input type.
source§

impl From<String> for ConValue

source§

fn from(value: String) -> Self

Converts to this type from the input type.
source§

impl From<Vec<ConValue>> for ConValue

source§

fn from(value: Vec<ConValue>) -> Self

Converts to this type from the input type.
source§

impl From<bool> for ConValue

source§

fn from(value: bool) -> Self

Converts to this type from the input type.
source§

impl From<char> for ConValue

source§

fn from(value: char) -> Self

Converts to this type from the input type.
source§

impl From<isize> for ConValue

source§

fn from(value: isize) -> Self

Converts to this type from the input type.
source§

impl Mul for ConValue

source§

fn mul(self, rhs: Self) -> Self::Output

TODO: Desugar operators into function calls

§

type Output = Result<ConValue, Error>

The resulting type after applying the * operator.
source§

impl Rem for ConValue

source§

fn rem(self, rhs: Self) -> Self::Output

TODO: Desugar operators into function calls

§

type Output = Result<ConValue, Error>

The resulting type after applying the % operator.
source§

impl Shl for ConValue

source§

fn shl(self, rhs: Self) -> Self::Output

TODO: Desugar operators into function calls

§

type Output = Result<ConValue, Error>

The resulting type after applying the << operator.
source§

impl Shr for ConValue

source§

fn shr(self, rhs: Self) -> Self::Output

TODO: Desugar operators into function calls

§

type Output = Result<ConValue, Error>

The resulting type after applying the >> operator.
source§

impl Sub for ConValue

source§

fn sub(self, rhs: Self) -> Self::Output

TODO: Desugar operators into function calls

§

type Output = Result<ConValue, Error>

The resulting type after applying the - operator.

Auto Trait Implementations§

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
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

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.

source§

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

§

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> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

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

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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.