Enum CompoundCommandKind

Source
pub enum CompoundCommandKind<V, W, C> {
    Brace(Vec<C>),
    Subshell(Vec<C>),
    While(GuardBodyPair<C>),
    Until(GuardBodyPair<C>),
    If {
        conditionals: Vec<GuardBodyPair<C>>,
        else_branch: Option<Vec<C>>,
    },
    For {
        var: V,
        words: Option<Vec<W>>,
        body: Vec<C>,
    },
    Case {
        word: W,
        arms: Vec<PatternBodyPair<W, C>>,
    },
}
Expand description

A specific kind of a CompoundCommand.

Generic over the representation of shell words and commands.

Variants§

§

Brace(Vec<C>)

A group of commands that should be executed in the current environment.

§

Subshell(Vec<C>)

A group of commands that should be executed in a subshell environment.

§

While(GuardBodyPair<C>)

A command that executes its body as long as its guard exits successfully.

§

Until(GuardBodyPair<C>)

A command that executes its body as until as its guard exits unsuccessfully.

§

If

A conditional command that runs the respective command branch when a certain of the first condition that exits successfully.

Fields

§conditionals: Vec<GuardBodyPair<C>>

A list of conditional branch-body pairs.

§else_branch: Option<Vec<C>>

An else part to run if no other conditional was taken.

§

For

A command that binds a variable to a number of provided words and runs its body once for each binding.

Fields

§var: V

The variable to bind to each of the specified words.

§words: Option<Vec<W>>

The words to bind to the specified variable one by one.

§body: Vec<C>

The body to run with the variable binding.

§

Case

A command that behaves much like a match statment in Rust, running a branch of commands if a specified word matches another literal or glob pattern.

Fields

§word: W

The word on which to check for pattern matches.

§arms: Vec<PatternBodyPair<W, C>>

The arms to match against.

Trait Implementations§

Source§

impl<V: Clone, W: Clone, C: Clone> Clone for CompoundCommandKind<V, W, C>

Source§

fn clone(&self) -> CompoundCommandKind<V, W, C>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<V: Debug, W: Debug, C: Debug> Debug for CompoundCommandKind<V, W, C>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<V: PartialEq, W: PartialEq, C: PartialEq> PartialEq for CompoundCommandKind<V, W, C>

Source§

fn eq(&self, other: &CompoundCommandKind<V, W, C>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<V: Eq, W: Eq, C: Eq> Eq for CompoundCommandKind<V, W, C>

Source§

impl<V, W, C> StructuralPartialEq for CompoundCommandKind<V, W, C>

Auto Trait Implementations§

§

impl<V, W, C> Freeze for CompoundCommandKind<V, W, C>
where V: Freeze, W: Freeze,

§

impl<V, W, C> RefUnwindSafe for CompoundCommandKind<V, W, C>

§

impl<V, W, C> Send for CompoundCommandKind<V, W, C>
where V: Send, W: Send, C: Send,

§

impl<V, W, C> Sync for CompoundCommandKind<V, W, C>
where V: Sync, W: Sync, C: Sync,

§

impl<V, W, C> Unpin for CompoundCommandKind<V, W, C>
where V: Unpin, W: Unpin, C: Unpin,

§

impl<V, W, C> UnwindSafe for CompoundCommandKind<V, W, C>
where V: UnwindSafe, W: UnwindSafe, C: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.