#[non_exhaustive]pub enum StringTestOp {
IsEmpty,
IsNonEmpty,
IsList,
IsRecord,
}Expand description
String test operators for [[ ]].
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
IsEmpty
-z - string is empty
IsNonEmpty
-n - string is non-empty
IsList
-list - value is a native list (Value::Json(Array)). Shape guard for
an API that sometimes returns an object where a list is expected — see
docs/LANGUAGE.md, “Shape guards”. Evaluates
the operand’s value, like -z/-n, not a path stat like -f/-d.
A defined-but-wrong-shaped value is false; a bare unset $var is an
undefined-variable error (like -z/-n), so a typo isn’t silently false.
IsRecord
-record - value is a native record (Value::Json(Object)). See
StringTestOp::IsList.
Implementations§
Source§impl StringTestOp
impl StringTestOp
Sourcepub fn matches_shape(self, value: &Value) -> bool
pub fn matches_shape(self, value: &Value) -> bool
Does value match this shape-guard operator? Only meaningful for
StringTestOp::IsList / StringTestOp::IsRecord — returns false
for IsEmpty/IsNonEmpty (callers evaluate those separately via
string-empty checks, not this predicate).
Shared by both the sync (interpreter/eval.rs) and async
(kernel.rs::eval_test_async) [[ ]] evaluators so the two paths
can’t diverge on the shape rule.
Trait Implementations§
Source§impl Clone for StringTestOp
impl Clone for StringTestOp
Source§fn clone(&self) -> StringTestOp
fn clone(&self) -> StringTestOp
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for StringTestOp
Source§impl Debug for StringTestOp
impl Debug for StringTestOp
Source§impl Display for StringTestOp
impl Display for StringTestOp
impl Eq for StringTestOp
Source§impl PartialEq for StringTestOp
impl PartialEq for StringTestOp
impl StructuralPartialEq for StringTestOp
Auto Trait Implementations§
impl Freeze for StringTestOp
impl RefUnwindSafe for StringTestOp
impl Send for StringTestOp
impl Sync for StringTestOp
impl Unpin for StringTestOp
impl UnsafeUnpin for StringTestOp
impl UnwindSafe for StringTestOp
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
impl<T> OrderedSeq<'_, T> for Twhere
T: Clone,
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
Source§impl<T, S> SpanWrap<S> for Twhere
S: WrappingSpan<T>,
impl<T, S> SpanWrap<S> for Twhere
S: WrappingSpan<T>,
Source§fn with_span(self, span: S) -> <S as WrappingSpan<Self>>::Spanned
fn with_span(self, span: S) -> <S as WrappingSpan<Self>>::Spanned
WrappingSpan::make_wrapped to wrap an AST node in a span.