Struct AtomicDefaultBuilder

Source
pub struct AtomicDefaultBuilder<T>(/* private fields */);
Expand description

A Builder implementation which builds shell commands using the (atomic) AST definitions in the ast module.

Implementations§

Source§

impl<T> AtomicDefaultBuilder<T>

Source

pub fn new() -> Self

Constructs a builder.

Trait Implementations§

Source§

impl<T: From<String>> Builder for AtomicDefaultBuilder<T>

Source§

type Command = AtomicTopLevelCommand<T>

The type which represents a complete, top-level command.
Source§

type CommandList = AndOrList<<AtomicDefaultBuilder<T> as Builder>::ListableCommand>

The type which represents an and/or list of commands.
Source§

type ListableCommand = ListableCommand<<AtomicDefaultBuilder<T> as Builder>::PipeableCommand>

The type which represents a command that can be used in an and/or command list.
Source§

type PipeableCommand = PipeableCommand<T, Box<SimpleCommand<T, <AtomicDefaultBuilder<T> as Builder>::Word, Redirect<<AtomicDefaultBuilder<T> as Builder>::Word>>>, Box<CompoundCommand<CompoundCommandKind<T, <AtomicDefaultBuilder<T> as Builder>::Word, <AtomicDefaultBuilder<T> as Builder>::Command>, Redirect<<AtomicDefaultBuilder<T> as Builder>::Word>>>, Arc<CompoundCommand<CompoundCommandKind<T, <AtomicDefaultBuilder<T> as Builder>::Word, <AtomicDefaultBuilder<T> as Builder>::Command>, Redirect<<AtomicDefaultBuilder<T> as Builder>::Word>>>>

The type which represents a command that can be used in a pipeline.
Source§

type CompoundCommand = CompoundCommand<CompoundCommandKind<T, <AtomicDefaultBuilder<T> as Builder>::Word, <AtomicDefaultBuilder<T> as Builder>::Command>, Redirect<<AtomicDefaultBuilder<T> as Builder>::Word>>

The type which represents compound commands like if, case, for, etc.
Source§

type Word = AtomicTopLevelWord<T>

The type which represents shell words, which can be command names or arguments.
Source§

type Redirect = Redirect<<AtomicDefaultBuilder<T> as Builder>::Word>

The type which represents a file descriptor redirection.
Source§

type Error = Void

A type for returning custom parse/build errors.
Source§

fn complete_command( &mut self, pre_cmd_comments: Vec<Newline>, list: Self::CommandList, separator: SeparatorKind, cmd_comment: Option<Newline>, ) -> Result<Self::Command, Self::Error>

Invoked once a complete command is found. That is, a command delimited by a newline, semicolon, ampersand, or the end of input. Read more
Source§

fn and_or_list( &mut self, first: Self::ListableCommand, rest: Vec<(Vec<Newline>, AndOr<Self::ListableCommand>)>, ) -> Result<Self::CommandList, Self::Error>

Invoked when multiple commands are parsed which are separated by && or ||. Typically after the first command is run, each of the following commands may or may not be executed, depending on the exit status of the previously executed command. Read more
Source§

fn pipeline( &mut self, bang: bool, cmds: Vec<(Vec<Newline>, Self::PipeableCommand)>, ) -> Result<Self::ListableCommand, Self::Error>

Invoked when a pipeline of commands is parsed. A pipeline is one or more commands where the standard output of the previous typically becomes the standard input of the next. Read more
Source§

fn simple_command( &mut self, redirects_or_env_vars: Vec<RedirectOrEnvVar<Self::Redirect, String, Self::Word>>, redirects_or_cmd_words: Vec<RedirectOrCmdWord<Self::Redirect, Self::Word>>, ) -> Result<Self::PipeableCommand, Self::Error>

Invoked when the “simplest” possible command is parsed: an executable with arguments. Read more
Source§

fn brace_group( &mut self, cmds: CommandGroup<Self::Command>, redirects: Vec<Self::Redirect>, ) -> Result<Self::CompoundCommand, Self::Error>

Invoked when a non-zero number of commands were parsed between balanced curly braces. Typically these commands should run within the current shell environment. Read more
Source§

fn subshell( &mut self, cmds: CommandGroup<Self::Command>, redirects: Vec<Self::Redirect>, ) -> Result<Self::CompoundCommand, Self::Error>

Invoked when a non-zero number of commands were parsed between balanced parentheses. Typically these commands should run within their own environment without affecting the shell’s global environment. Read more
Source§

fn loop_command( &mut self, kind: LoopKind, guard_body_pair: GuardBodyPairGroup<Self::Command>, redirects: Vec<Self::Redirect>, ) -> Result<Self::CompoundCommand, Self::Error>

Invoked when a loop command like while or until is parsed. Typically these commands will execute their body based on the exit status of their guard. Read more
Source§

fn if_command( &mut self, fragments: IfFragments<Self::Command>, redirects: Vec<Self::Redirect>, ) -> Result<Self::CompoundCommand, Self::Error>

Invoked when an if conditional command is parsed. Typically an if command is made up of one or more guard-body pairs, where the body of the first successful corresponding guard is executed. There can also be an optional else part to be run if no guard is successful. Read more
Source§

fn for_command( &mut self, fragments: ForFragments<Self::Word, Self::Command>, redirects: Vec<Self::Redirect>, ) -> Result<Self::CompoundCommand, Self::Error>

Invoked when a for command is parsed. Typically a for command binds a variable to each member in a group of words and invokes its body with that variable present in the environment. If no words are specified, the command will iterate over the arguments to the script or enclosing function. Read more
Source§

fn case_command( &mut self, fragments: CaseFragments<Self::Word, Self::Command>, redirects: Vec<Self::Redirect>, ) -> Result<Self::CompoundCommand, Self::Error>

Invoked when a case command is parsed. Typically this command will execute certain commands when a given word matches a pattern. Read more
Source§

fn compound_command_into_pipeable( &mut self, cmd: Self::CompoundCommand, ) -> Result<Self::PipeableCommand, Self::Error>

Bridges the gap between a PipeableCommand and a CompoundCommand since CompoundCommands are typically PipeableCommands as well. Read more
Source§

fn function_declaration( &mut self, name: String, post_name_comments: Vec<Newline>, body: Self::CompoundCommand, ) -> Result<Self::PipeableCommand, Self::Error>

Invoked when a function declaration is parsed. Typically a function declaration overwrites any previously defined function within the current environment. Read more
Source§

fn comments(&mut self, comments: Vec<Newline>) -> Result<(), Self::Error>

Invoked when only comments are parsed with no commands following. This can occur if an entire shell script is commented out or if there are comments present at the end of the script. Read more
Source§

fn word( &mut self, kind: ComplexWordKind<Self::Command>, ) -> Result<Self::Word, Self::Error>

Invoked when a word is parsed. Read more
Source§

fn redirect( &mut self, kind: RedirectKind<Self::Word>, ) -> Result<Self::Redirect, Self::Error>

Invoked when a redirect is parsed. Read more
Source§

impl<T> Clone for AtomicDefaultBuilder<T>

Source§

fn clone(&self) -> Self

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<T> Debug for AtomicDefaultBuilder<T>

Source§

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

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

impl<T> Default for AtomicDefaultBuilder<T>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<T> Copy for AtomicDefaultBuilder<T>

Auto Trait Implementations§

§

impl<T> Freeze for AtomicDefaultBuilder<T>

§

impl<T> RefUnwindSafe for AtomicDefaultBuilder<T>
where T: RefUnwindSafe,

§

impl<T> Send for AtomicDefaultBuilder<T>
where T: Send + Sync,

§

impl<T> Sync for AtomicDefaultBuilder<T>
where T: Sync + Send,

§

impl<T> Unpin for AtomicDefaultBuilder<T>
where T: Unpin,

§

impl<T> UnwindSafe for AtomicDefaultBuilder<T>

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.