pub enum Term<S> {
Show 17 variants
Id,
Recurse,
Num(S),
Str(Option<S>, Vec<StrPart<S, Self>>),
Arr(Option<Box<Self>>),
Obj(Vec<(Self, Option<Self>)>),
Neg(Box<Self>),
BinOp(Box<Self>, BinaryOp<S>, Box<Self>),
Label(S, Box<Self>),
Break(S),
Fold(S, Box<Self>, Pattern<S>, Vec<Self>),
TryCatch(Box<Self>, Option<Box<Self>>),
IfThenElse(Vec<(Self, Self)>, Option<Box<Self>>),
Def(Vec<Def<S, Self>>, Box<Self>),
Call(S, Vec<Self>),
Var(S),
Path(Box<Self>, Path<Self>),
}Expand description
Function from value to stream of values, such as .[] | add / length.
Variants§
Id
Identity, i.e. .
Recurse
Recursion (..)
Num(S)
Integer or floating-point number
Str(Option<S>, Vec<StrPart<S, Self>>)
String
This consists of an optional format filter starting with @ (such as @text),
followed by quoted string parts (such as "Hello, \(.name)! \u263A").
Arr(Option<Box<Self>>)
Array, empty if None
Obj(Vec<(Self, Option<Self>)>)
Object, specifying its key-value pairs
Neg(Box<Self>)
Negation
BinOp(Box<Self>, BinaryOp<S>, Box<Self>)
Sequence of binary operations, e.g. 1 + 2 - 3 * 4
Label(S, Box<Self>)
Control flow variable declaration, e.g. label $x | ...
Break(S)
Break out from control flow to location variable, e.g. break $x
Fold(S, Box<Self>, Pattern<S>, Vec<Self>)
reduce and foreach, e.g. reduce .[] as $x (0; .+$x)
TryCatch(Box<Self>, Option<Box<Self>>)
try and optional catch
IfThenElse(Vec<(Self, Self)>, Option<Box<Self>>)
If-then-else
Def(Vec<Def<S, Self>>, Box<Self>)
Local definition
Call(S, Vec<Self>)
Call to another filter, e.g. map(.+1)
Var(S)
Variable, such as $x (including leading ‘$’)
Path(Box<Self>, Path<Self>)
Path such as .a, .[][]."b", f[0]
Trait Implementations§
Auto Trait Implementations§
impl<S> Freeze for Term<S>where
S: Freeze,
impl<S> RefUnwindSafe for Term<S>where
S: RefUnwindSafe,
impl<S> Send for Term<S>where
S: Send,
impl<S> Sync for Term<S>where
S: Sync,
impl<S> Unpin for Term<S>where
S: Unpin,
impl<S> UnsafeUnpin for Term<S>where
S: UnsafeUnpin,
impl<S> UnwindSafe for Term<S>where
S: 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