#[non_exhaustive]pub enum CompoundKind<'a> {
For {
var: &'a str,
words: Option<Vec<Word<'a>>>,
body: Vec<Cmd<'a>>,
},
While(GuardBody<'a>),
Until(GuardBody<'a>),
If {
conditionals: Vec<GuardBody<'a>>,
else_branch: Option<Vec<Cmd<'a>>>,
},
Case {
word: Word<'a>,
arms: Vec<CaseArm<'a>>,
},
CFor {
init: Option<Arith<'a>>,
cond: Option<Arith<'a>>,
step: Option<Arith<'a>>,
body: Vec<Cmd<'a>>,
},
Brace(Vec<Cmd<'a>>),
Subshell(Vec<Cmd<'a>>),
DoubleBracket(Vec<Cmd<'a>>),
Arithmetic(Arith<'a>),
}Expand description
The body of a compound command.
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.
For
for var [in words]; do body; done
Fields
While(GuardBody<'a>)
while guard; do body; done
Until(GuardBody<'a>)
until guard; do body; done
If
if cond; then body; [elif ...;] [else ...;] fi
Fields
Case
case word in pattern) body;; ... esac
CFor
C-style for loop: for (( init; cond; step )); do body; done
Fields
Brace(Vec<Cmd<'a>>)
{ body; } — brace group.
Subshell(Vec<Cmd<'a>>)
( body ) — subshell.
DoubleBracket(Vec<Cmd<'a>>)
[[ expression ]] — extended test command.
Arithmetic(Arith<'a>)
(( expression )) — arithmetic command.
Trait Implementations§
Source§impl<'a> Clone for CompoundKind<'a>
impl<'a> Clone for CompoundKind<'a>
Source§fn clone(&self) -> CompoundKind<'a>
fn clone(&self) -> CompoundKind<'a>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<'a> Debug for CompoundKind<'a>
impl<'a> Debug for CompoundKind<'a>
Source§impl<'a> PartialEq for CompoundKind<'a>
impl<'a> PartialEq for CompoundKind<'a>
impl<'a> Eq for CompoundKind<'a>
impl<'a> StructuralPartialEq for CompoundKind<'a>
Auto Trait Implementations§
impl<'a> Freeze for CompoundKind<'a>
impl<'a> RefUnwindSafe for CompoundKind<'a>
impl<'a> Send for CompoundKind<'a>
impl<'a> Sync for CompoundKind<'a>
impl<'a> Unpin for CompoundKind<'a>
impl<'a> UnsafeUnpin for CompoundKind<'a>
impl<'a> UnwindSafe for CompoundKind<'a>
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