Struct geo_aid::generator::expression::Expression
source · pub struct Expression<T> {
pub weights: Weights,
pub kind: T,
}
Expand description
An expression is a base construct of Geo-AID. Contains a cache, saved weights and the expression kind itself.
Fields§
§weights: Weights
Saved weights
kind: T
Expression kind.
Implementations§
source§impl<T: Evaluate + Kind> Expression<T>
impl<T: Evaluate + Kind> Expression<T>
pub fn new(expr: T, weight: FastFloat) -> Self
sourcepub fn get_address(self: &Arc<Self>) -> usize
pub fn get_address(self: &Arc<Self>) -> usize
Gets the expressions address.
sourcepub fn evaluate(self: &Arc<Self>, args: &EvaluationArgs<'_>) -> T::Output
pub fn evaluate(self: &Arc<Self>, args: &EvaluationArgs<'_>) -> T::Output
sourcepub fn collect(self: &Arc<Self>, exprs: &mut Vec<usize>)
pub fn collect(self: &Arc<Self>, exprs: &mut Vec<usize>)
Collects expressions that should be cached.
sourcepub fn is_trivial(&self) -> bool
pub fn is_trivial(&self) -> bool
Trivial expressions are ones that don’t require any calculations being made. Trivial expressions should not be cached, as it is much faster to evaluate them than to get their caches.
Trait Implementations§
source§impl<T: Clone> Clone for Expression<T>
impl<T: Clone> Clone for Expression<T>
source§fn clone(&self) -> Expression<T>
fn clone(&self) -> Expression<T>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<T: Debug> Debug for Expression<T>
impl<T: Debug> Debug for Expression<T>
Auto Trait Implementations§
impl<T> RefUnwindSafe for Expression<T>where
T: RefUnwindSafe,
impl<T> Send for Expression<T>where
T: Send,
impl<T> Sync for Expression<T>where
T: Sync,
impl<T> Unpin for Expression<T>where
T: Unpin,
impl<T> UnwindSafe for Expression<T>where
T: UnwindSafe,
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> CloneWithNode for Twhere
T: Clone,
impl<T> CloneWithNode for Twhere
T: Clone,
fn clone_with_node(&mut self) -> T
fn clone_without_node(&self) -> T
source§impl<T> Convert for T
impl<T> Convert for T
source§fn convert<U>(self, context: &CompileContext) -> Expr<U>where
U: ConvertFrom<T>,
fn convert<U>(self, context: &CompileContext) -> Expr<U>where
U: ConvertFrom<T>,
Errors Read more
source§fn can_convert<U>(&self) -> boolwhere
U: ConvertFrom<T>,
fn can_convert<U>(&self) -> boolwhere
U: ConvertFrom<T>,
Errors Read more