Skip to main content

TypedValue

Enum TypedValue 

Source
pub enum TypedValue<T = DefaultTypeSet>
where T: TypeSet,
{ Void, MaybeSignedInt(<T as TypeSet>::Integer), Int(<T as TypeSet>::Integer), SignedInt(<T as TypeSet>::SignedInteger), Float(<T as TypeSet>::Float), Bool(bool), String(<T as TypeSet>::String), Iter(<T as TypeSet>::Iterator), Struct(SomniStruct<T>), Ref(Reference), }
Expand description

Represents any value in the expression language.

Variants§

§

Void

Represents no value.

§

MaybeSignedInt(<T as TypeSet>::Integer)

Represents an integer that may be signed or unsigned.

MaybeSignedInt can compare equal with Int and SignedInt.

§

Int(<T as TypeSet>::Integer)

Represents an unsigned integer.

§

SignedInt(<T as TypeSet>::SignedInteger)

Represents a signed integer.

§

Float(<T as TypeSet>::Float)

Represents a floating-point.

§

Bool(bool)

Represents a boolean.

§

String(<T as TypeSet>::String)

Represents a string.

§

Iter(<T as TypeSet>::Iterator)

Represents an iterator.

§

Struct(SomniStruct<T>)

Represents a struct value: a named aggregate of typed fields.

§

Ref(Reference)

Represents a reference to a place (a variable, or a field within one).

Implementations§

Source§

impl<T> TypedValue<T>
where T: TypeSet,

Source

pub fn type_of(&self) -> Type

Returns the Somni type of this value.

Trait Implementations§

Source§

impl<T> Clone for TypedValue<T>
where T: TypeSet,

Source§

fn clone(&self) -> TypedValue<T>

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<T> Debug for TypedValue<T>
where T: Debug + TypeSet, <T as TypeSet>::Integer: Debug, <T as TypeSet>::SignedInteger: Debug, <T as TypeSet>::Float: Debug, <T as TypeSet>::String: Debug, <T as TypeSet>::Iterator: Debug,

Source§

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

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

impl IntoValue for TypedValue<TemplateTypes>

Source§

fn into_value(self) -> TypedValue<TemplateTypes>

Converts self into a Somni value.
Source§

impl<T> LoadOwned<T> for TypedValue<T>
where T: TypeSet,

Source§

type Output = TypedValue<T>

The type of the result.
Source§

fn load_owned(_ctx: &T, typed: &TypedValue<T>) -> Option<TypedValue<T>>

Loads an owned value from the given type context.
Source§

impl<T> LoadStore<T> for TypedValue<T>
where T: TypeSet,

Source§

type Output<'s> = TypedValue<T>

The type of the result.
Source§

fn load(ctx: &T, typed: &TypedValue<T>) -> Option<TypedValue<T>>

Loads a borrowed value from the given type context.
Source§

fn store(&self, _ctx: &mut T) -> TypedValue<T>

Stores a Rust value into a TypedValue using the given type context.
Source§

impl<T> PartialEq for TypedValue<T>
where T: TypeSet,

Source§

fn eq(&self, other: &TypedValue<T>) -> bool

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

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

Inequality operator !=. Read more

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> 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.

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,

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.