pub struct Expr<T> { /* private fields */ }Expand description
A parse-checked Jetro expression with a phantom output type.
The phantom T captures the caller’s intent about the result
shape and is used by typed accessors (e.g. Bucket::get_as) to
drive serde deserialisation. It is not statically verified —
constructing an Expr<u64> from an expression that yields a
string is possible; the mismatch surfaces at evaluation time as a
deserialisation error.
Implementations§
Source§impl<T> Expr<T>
impl<T> Expr<T>
Sourcepub fn new<S: Into<String>>(src: S) -> Result<Self, Error>
pub fn new<S: Into<String>>(src: S) -> Result<Self, Error>
Parse and wrap src. Returns Error::Parse if the
expression is not syntactically valid.
Sourcepub fn as_str(&self) -> &str
pub fn as_str(&self) -> &str
Raw source text — useful for storing in an [ExprBucket] or
for debugging.
Sourcepub fn into_string(self) -> String
pub fn into_string(self) -> String
Discard the phantom output type. Rarely needed; cast::<U>
is usually what callers want.
Source§impl<T: DeserializeOwned> Expr<T>
impl<T: DeserializeOwned> Expr<T>
Trait Implementations§
Source§impl<T, U> BitOr<Expr<U>> for Expr<T>
a | b → expression source "(a) | (b)". The resulting type is
Expr<U> since the right-hand side determines the output shape.
impl<T, U> BitOr<Expr<U>> for Expr<T>
a | b → expression source "(a) | (b)". The resulting type is
Expr<U> since the right-hand side determines the output shape.