pub struct Scope { /* private fields */ }Expand description
Scope define the evaluation context/scope that an expression uses when being evaluated.
There is a special Identifier (Identity) which is used to bind the initial array being evaluated
Other identifier can be bound with variables either before execution or while executing (see Let).
Values can be extracted from the scope using the Var expression.
<let x = lit(1) in var(Identifier::Identity) + var(x), { Identity -> Primitive[1,2,3]> ->
<var(Identifier::Identity) + var(x), { Identity -> Primitive[1,2,3], x -> ConstantArray(1)> ->
<Primitive[1,2,3] + var(x), { Identity -> Primitive[1,2,3], x -> ConstantArray(1)> ->
<Primitive[1,2,3] + ConstantArray(1), { Identity -> Primitive[1,2,3], x -> ConstantArray(1)> ->
<Primitive[2,3,4], { Identity -> Primitive[1,2,3], x -> ConstantArray(1)>Other values can be bound before execution e.g.
<var("x") + var("y") + var("z"), x -> ..., y -> ..., z -> ...>
Implementations§
Source§impl Scope
impl Scope
Sourcepub fn with_scope_var<V: ScopeVar>(self, var: V) -> Self
pub fn with_scope_var<V: ScopeVar>(self, var: V) -> Self
Returns a new evaluation scope with the given variable applied.
Sourcepub fn scope_var<V: ScopeVar>(&self) -> Option<&V>
pub fn scope_var<V: ScopeVar>(&self) -> Option<&V>
Returns the scope variable of type V if it exists.
Sourcepub fn scope_var_mut<V: ScopeVar>(&mut self) -> Option<&mut V>
pub fn scope_var_mut<V: ScopeVar>(&mut self) -> Option<&mut V>
Returns the mutable scope variable of type V if it exists.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Scope
impl !RefUnwindSafe for Scope
impl Send for Scope
impl Sync for Scope
impl Unpin for Scope
impl !UnwindSafe for Scope
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more