Entry

Enum Entry 

Source
pub enum Entry<'a> {
    Expr(&'a Expr),
    Value(&'a Value),
}

Variants§

§

Expr(&'a Expr)

§

Value(&'a Value)

Implementations§

Source§

impl Entry<'_>

Source

pub fn eval(&self, input: impl Input) -> Result<Value>

Evaluates the entry to a value using the provided input.

For Entry::Expr, evaluates the expression with the given input context. For Entry::Value, returns a clone of the value directly.

§Examples
let value = Value::from(42);
let entry = Entry::from(&value);

let result = entry.eval(ConstInput::new()).unwrap();
assert_eq!(result, Value::from(42));
Source

pub fn eval_const(&self) -> Result<Value>

Evaluates the entry as a constant expression.

For Entry::Expr, attempts to evaluate the expression without any input context. This only succeeds if the expression is constant (contains no references or arguments). For Entry::Value, returns a clone of the value directly.

§Errors

Returns an error if the entry contains an expression that cannot be evaluated as a constant (e.g., references to columns or arguments).

§Examples
let value = Value::from("hello");
let entry = Entry::from(&value);

let result = entry.eval_const().unwrap();
assert_eq!(result, Value::from("hello"));
Source

pub fn is_const(&self) -> bool

Returns true if the entry is a constant expression.

An entry is considered constant if it does not reference any external data:

  • Entry::Value is always constant
  • Entry::Expr is constant if the expression itself is constant (see Expr::is_const for details)

Constant entries can be evaluated without any input context.

§Examples
// Values are always constant
let value = Value::from(42);
let entry = Entry::from(&value);
assert!(entry.is_const());

// Constant expressions
let expr = Expr::from(Value::from("hello"));
let entry = Entry::from(&expr);
assert!(entry.is_const());
Source

pub fn is_expr(&self) -> bool

Source

pub fn to_expr(&self) -> Expr

Source

pub fn is_expr_default(&self) -> bool

Source

pub fn is_value(&self) -> bool

Source

pub fn is_value_null(&self) -> bool

Source

pub fn try_as_value(&self) -> Option<&Value>

Source

pub fn as_value(&self) -> &Value

Source

pub fn to_value(&self) -> Value

Trait Implementations§

Source§

impl<'a> Debug for Entry<'a>

Source§

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

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

impl<'a> From<&'a Expr> for Entry<'a>

Source§

fn from(value: &'a Expr) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a Value> for Entry<'a>

Source§

fn from(value: &'a Value) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Entry<'a>> for Expr

Source§

fn from(value: Entry<'a>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<'a> Freeze for Entry<'a>

§

impl<'a> RefUnwindSafe for Entry<'a>

§

impl<'a> Send for Entry<'a>

§

impl<'a> Sync for Entry<'a>

§

impl<'a> Unpin for Entry<'a>

§

impl<'a> UnwindSafe for Entry<'a>

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> 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> Same for T

Source§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V