pub struct Expression {
pub value: Value,
pub text: Rc<str>,
pub location: Location,
}
Expand description
An expression in a Rego query.
// Create engine and evaluate "1 + 2".
let results = Engine::new().eval_query("1 + 2".to_string(), false)?;
// Fetch the expression from results.
let expr = &results.result[0].expressions[0];
assert_eq!(expr.value, Value::from(3u64));
assert_eq!(expr.text.as_ref(), "1 + 2");
See also QueryResult
.
Fields§
§value: Value
Computed value of the expression.
text: Rc<str>
The Rego expression.
location: Location
Location of the expression in the query string.
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 PartialEq for Expression
impl PartialEq for Expression
Source§impl Serialize for Expression
impl Serialize for Expression
impl Eq for Expression
impl StructuralPartialEq 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