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>
impl<T> AtomicDefaultBuilder<T>
Trait Implementations§
Source§impl<T: From<String>> Builder for AtomicDefaultBuilder<T>
impl<T: From<String>> Builder for AtomicDefaultBuilder<T>
Source§type Command = AtomicTopLevelCommand<T>
type Command = AtomicTopLevelCommand<T>
The type which represents a complete, top-level command.
Source§type CommandList = AndOrList<<AtomicDefaultBuilder<T> as Builder>::ListableCommand>
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>
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>>>>
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>>
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>
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>
type Redirect = Redirect<<AtomicDefaultBuilder<T> as Builder>::Word>
The type which represents a file descriptor redirection.
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>
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>
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 moreSource§fn pipeline(
&mut self,
bang: bool,
cmds: Vec<(Vec<Newline>, Self::PipeableCommand)>,
) -> Result<Self::ListableCommand, Self::Error>
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>
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>
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>
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>
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 moreSource§fn if_command(
&mut self,
fragments: IfFragments<Self::Command>,
redirects: Vec<Self::Redirect>,
) -> Result<Self::CompoundCommand, Self::Error>
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 moreSource§fn for_command(
&mut self,
fragments: ForFragments<Self::Word, Self::Command>,
redirects: Vec<Self::Redirect>,
) -> Result<Self::CompoundCommand, Self::Error>
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 moreSource§fn case_command(
&mut self,
fragments: CaseFragments<Self::Word, Self::Command>,
redirects: Vec<Self::Redirect>,
) -> Result<Self::CompoundCommand, Self::Error>
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 moreSource§fn compound_command_into_pipeable(
&mut self,
cmd: Self::CompoundCommand,
) -> Result<Self::PipeableCommand, Self::Error>
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
CompoundCommand
s are typically PipeableCommand
s as well. Read moreSource§fn function_declaration(
&mut self,
name: String,
post_name_comments: Vec<Newline>,
body: Self::CompoundCommand,
) -> Result<Self::PipeableCommand, Self::Error>
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>
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§impl<T> Clone for AtomicDefaultBuilder<T>
impl<T> Clone for AtomicDefaultBuilder<T>
Source§impl<T> Debug for AtomicDefaultBuilder<T>
impl<T> Debug for AtomicDefaultBuilder<T>
Source§impl<T> Default for AtomicDefaultBuilder<T>
impl<T> Default for AtomicDefaultBuilder<T>
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>
impl<T> Sync for AtomicDefaultBuilder<T>
impl<T> Unpin for AtomicDefaultBuilder<T>where
T: Unpin,
impl<T> UnwindSafe for AtomicDefaultBuilder<T>where
T: UnwindSafe + RefUnwindSafe,
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