Skip to main content

TypeSet

Trait TypeSet 

Source
pub trait TypeSet:
    Sized
    + Default
    + Debug
    + 'static {
    type Parser: ParserTypeSet<Integer = Self::Integer, Float = Self::Float>;
    type Integer: Copy + ValueType<NegateOutput: LoadStore<Self>> + LoadStore<Self>;
    type SignedInteger: Copy + ValueType<NegateOutput: LoadStore<Self>> + LoadStore<Self>;
    type Float: Copy + ValueType<NegateOutput: LoadStore<Self>> + LoadStore<Self>;
    type String: ValueType<NegateOutput: LoadStore<Self>> + LoadStore<Self>;
    type Iterator: Clone + PartialEq + Debug;

    // Required methods
    fn to_signed(v: Self::Integer) -> Result<Self::SignedInteger, OperatorError>;
    fn to_usize(v: Self::Integer) -> Result<usize, OperatorError>;
    fn int_from_usize(v: usize) -> Self::Integer;
    fn load_string<'s>(&'s self, str: &'s Self::String) -> &'s str;
    fn store_string(&mut self, str: &str) -> Self::String;
    fn iter_has_next(&self, iter: &Self::Iterator) -> bool;
    fn iter_next(&self, iter: &Self::Iterator) -> Option<TypedValue<Self>>;
}
Expand description

Defines the backing types for Somni types.

The LoadStore and LoadOwned traits can be used to convert between Rust and Somni types.

Required Associated Types§

Source

type Parser: ParserTypeSet<Integer = Self::Integer, Float = Self::Float>

The typeset that will be used to parse source code.

Source

type Integer: Copy + ValueType<NegateOutput: LoadStore<Self>> + LoadStore<Self>

The type of unsigned integers in this type set.

Source

type SignedInteger: Copy + ValueType<NegateOutput: LoadStore<Self>> + LoadStore<Self>

The type of signed integers in this type set.

Source

type Float: Copy + ValueType<NegateOutput: LoadStore<Self>> + LoadStore<Self>

The type of floating point numbers in this type set.

Source

type String: ValueType<NegateOutput: LoadStore<Self>> + LoadStore<Self>

The type of a string in this type set.

Source

type Iterator: Clone + PartialEq + Debug

The type of an iterator value in this type set.

This is the payload carried directly by TypedValue::Iter. Type sets that do not support iteration use the uninhabited NoIterator, making it impossible to construct an iterator value.

Required Methods§

Source

fn to_signed(v: Self::Integer) -> Result<Self::SignedInteger, OperatorError>

Converts an unsigned integer into a signed integer.

Source

fn to_usize(v: Self::Integer) -> Result<usize, OperatorError>

Converts an unsigned integer into a Rust usize.

Source

fn int_from_usize(v: usize) -> Self::Integer

Converts the given Rust usize to an integer.

Source

fn load_string<'s>(&'s self, str: &'s Self::String) -> &'s str

Loads a string.

Source

fn store_string(&mut self, str: &str) -> Self::String

Stores a string.

Source

fn iter_has_next(&self, iter: &Self::Iterator) -> bool

Returns whether the given iterator can yield another value.

Source

fn iter_next(&self, iter: &Self::Iterator) -> Option<TypedValue<Self>>

Advances the given iterator, returning its next value, or None if the iterator is exhausted.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl TypeSet for DefaultTypeSet

Source§

impl TypeSet for TypeSet32

Source§

impl TypeSet for TypeSet128

Source§

impl TypeSet for WithIterator<DefaultTypeSet>

Source§

impl TypeSet for WithIterator<TypeSet32>

Source§

impl TypeSet for WithIterator<TypeSet128>