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

    // 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;
}
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.

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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§