pub struct Expression {
pub kind: ExpressionKind,
pub source_location: Option<Source>,
}Expand description
An expression that can be evaluated, with source location
Expressions use semantic equality and hashing - two expressions with the same structure (kind) are equal/hash-equal regardless of source location.
Fields§
§kind: ExpressionKind§source_location: Option<Source>Implementations§
Source§impl Expression
impl Expression
Sourcepub fn new(kind: ExpressionKind, source_location: Option<Source>) -> Self
pub fn new(kind: ExpressionKind, source_location: Option<Source>) -> Self
Create a new expression with kind and source location
Sourcepub fn get_source_text(
&self,
sources: &HashMap<String, String>,
) -> Option<String>
pub fn get_source_text( &self, sources: &HashMap<String, String>, ) -> Option<String>
Get the source text for this expression from the given sources map
Returns None if the expression has no source location or the source is not found.
Sourcepub fn collect_fact_paths(&self, facts: &mut HashSet<FactPath>)
pub fn collect_fact_paths(&self, facts: &mut HashSet<FactPath>)
Collect all FactPath references from this expression tree.
Trait Implementations§
Source§impl Clone for Expression
impl Clone for Expression
Source§fn clone(&self) -> Expression
fn clone(&self) -> Expression
Returns a duplicate 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 Debug for Expression
impl Debug for Expression
Source§impl<'de> Deserialize<'de> for Expression
impl<'de> Deserialize<'de> for Expression
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for Expression
impl Display for Expression
Source§impl Hash for Expression
Semantic hashing - hashes expression structure only, ignoring source location
impl Hash for Expression
Semantic hashing - hashes expression structure only, ignoring source location
Source§impl PartialEq for Expression
Semantic equality - compares expressions by structure only, ignoring source location
impl PartialEq for Expression
Semantic equality - compares expressions by structure only, ignoring source location
Source§impl Serialize for Expression
impl Serialize for Expression
impl Eq for Expression
Auto Trait Implementations§
impl Freeze for Expression
impl RefUnwindSafe for Expression
impl Send for Expression
impl Sync for Expression
impl Unpin for Expression
impl UnwindSafe for Expression
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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