Skip to main content

VectorExpression

Enum VectorExpression 

Source
pub enum VectorExpression {
    Reference(ReferenceExpression<Vector>),
    Indices(Box<VectorExpression>),
    Reverse(Box<VectorExpression>),
    Set(ElementExpression, Box<VectorExpression>, ElementExpression),
    Push(ElementExpression, Box<VectorExpression>),
    Pop(Box<VectorExpression>),
    FromSet(Box<SetExpression>),
    If(Box<Condition>, Box<VectorExpression>, Box<VectorExpression>),
}
Expand description

Vector expression.

Variants§

§

Reference(ReferenceExpression<Vector>)

Reference to a constant or a variable.

§

Indices(Box<VectorExpression>)

Indices of a vector.

§

Reverse(Box<VectorExpression>)

Reverse a vector.

§

Set(ElementExpression, Box<VectorExpression>, ElementExpression)

Set an element in a vector.

§

Push(ElementExpression, Box<VectorExpression>)

Push an element to a vector.

§

Pop(Box<VectorExpression>)

Pop an element from a vector.

§

FromSet(Box<SetExpression>)

Conversion from a set.

§

If(Box<Condition>, Box<VectorExpression>, Box<VectorExpression>)

If-then-else expression, which returns the first one if the condition holds and the second one otherwise.

Implementations§

Source§

impl VectorExpression

Source

pub fn eval<T: StateInterface>( &self, state: &T, function_cache: &mut StateFunctionCache, state_functions: &StateFunctions, registry: &TableRegistry, ) -> Vector

Returns the evaluation result.

§Panics

Panics if the cost of the transition state is used or a min/max reduce operation is performed on an empty set or vector.

Source

pub fn simplify(&self, registry: &TableRegistry) -> VectorExpression

Returns a simplified version by precomputation.

§Panics

Panics if the cost of the transition state is used or a min/max reduce operation is performed on an empty set or vector.

Trait Implementations§

Source§

impl AddEffect<VectorVariable, VectorExpression> for Transition

Source§

fn add_effect<V>( &mut self, v: VectorVariable, expression: V, ) -> Result<(), ModelErr>

Adds an effect. Read more
Source§

impl CheckExpression<VectorExpression> for Model

Source§

fn check_expression( &self, expression: &VectorExpression, allow_cost: bool, ) -> Result<(), ModelErr>

Checks if an expression is valid. Read more
Source§

impl Clone for VectorExpression

Source§

fn clone(&self) -> VectorExpression

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 VectorExpression

Source§

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

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

impl From<VectorExpression> for ArgumentExpression

Source§

fn from(v: VectorExpression) -> ArgumentExpression

Converts to this type from the input type.
Source§

impl PartialEq for VectorExpression

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for VectorExpression

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 = 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>,

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.