#[non_exhaustive]pub enum TestExpr {
FileTest {
op: FileTestOp,
path: Box<Expr>,
},
StringTest {
op: StringTestOp,
value: Box<Expr>,
},
Comparison {
left: Box<Expr>,
op: TestCmpOp,
right: Box<Expr>,
},
And {
left: Box<TestExpr>,
right: Box<TestExpr>,
},
Or {
left: Box<TestExpr>,
right: Box<TestExpr>,
},
Not {
expr: Box<TestExpr>,
},
In {
left: Box<Expr>,
right: Box<Expr>,
},
NotIn {
left: Box<Expr>,
right: Box<Expr>,
},
}Expand description
Test expression for [[ ... ]] conditionals.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
FileTest
File test: [[ -f path ]], [[ -d path ]], etc.
StringTest
String test: [[ -z str ]], [[ -n str ]]
Comparison
Comparison: [[ $X == "value" ]], [[ $NUM -gt 5 ]]
And
Logical AND: [[ -f a && -d b ]] (short-circuit evaluation)
Or
Logical OR: [[ -f a || -d b ]] (short-circuit evaluation)
Not
Logical NOT: [[ ! -f file ]]
In
Collection membership: [[ e in $list ]] (element) / [[ k in $record ]]
(key). A scalar or string RHS is a loud error — see docs/LANGUAGE.md,
“Membership”.
NotIn
Negated membership: [[ e not in $coll ]].
Trait Implementations§
impl StructuralPartialEq for TestExpr
Auto Trait Implementations§
impl Freeze for TestExpr
impl RefUnwindSafe for TestExpr
impl Send for TestExpr
impl Sync for TestExpr
impl Unpin for TestExpr
impl UnsafeUnpin for TestExpr
impl UnwindSafe for TestExpr
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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
Invokes
WrappingSpan::make_wrapped to wrap an AST node in a span.