Enum jrsonnet_evaluator::val::ArrValue
source · pub enum ArrValue {
Bytes(BytesArray),
Lazy(LazyArray),
Expr(ExprArray),
Eager(EagerArray),
Extended(Cc<ExtendedArray>),
Range(RangeArray),
Slice(Cc<SliceArray>),
Reverse(Cc<ReverseArray>),
Mapped(MappedArray),
Repeated(RepeatedArray),
}
Expand description
Represents a Jsonnet array value.
Variants§
Bytes(BytesArray)
Layout optimized byte array.
Lazy(LazyArray)
Every element is lazy evaluated.
Expr(ExprArray)
Every element is defined somewhere in source code
Eager(EagerArray)
Every field is already evaluated.
Extended(Cc<ExtendedArray>)
Concatenation of two arrays of any kind.
Range(RangeArray)
Represents a integer array in form [start, start + 1, ... end - 1, end]
.
This kind of arrays is generated by std.range(start, end)
call, and used for loops.
Slice(Cc<SliceArray>)
Sliced array view.
Reverse(Cc<ReverseArray>)
Reversed array view.
Returned by std.reverse(other)
call
Mapped(MappedArray)
Returned by std.map
call
Repeated(RepeatedArray)
Returned by std.repeat
call
Implementations§
source§impl ArrValue
impl ArrValue
pub fn empty() -> Self
pub fn expr(ctx: Context, exprs: impl IntoIterator<Item = LocExpr>) -> Self
pub fn lazy(thunks: Cc<Vec<Thunk<Val>>>) -> Self
pub fn eager(values: Vec<Val>) -> Self
pub fn repeated(data: ArrValue, repeats: usize) -> Option<Self>
pub fn bytes(bytes: IBytes) -> Self
pub fn map(self, mapper: FuncVal) -> Self
pub fn filter(self, filter: impl Fn(&Val) -> Result<bool>) -> Result<Self>
pub fn extended(a: ArrValue, b: ArrValue) -> Self
pub fn range_exclusive(a: i32, b: i32) -> Self
pub fn range_inclusive(a: i32, b: i32) -> Self
pub fn slice(
self,
from: Option<usize>,
to: Option<usize>,
step: Option<usize>
) -> Option<Self>
sourcepub fn get(&self, index: usize) -> Result<Option<Val>>
pub fn get(&self, index: usize) -> Result<Option<Val>>
Get array element by index, evaluating it, if it is lazy.
Returns None
on out-of-bounds condition.
sourcepub fn get_lazy(&self, index: usize) -> Option<Thunk<Val>>
pub fn get_lazy(&self, index: usize) -> Option<Thunk<Val>>
Get array element by index, without evaluation.
Returns None
on out-of-bounds condition.