Struct CoreBuilder

Source
pub struct CoreBuilder<T, W, C, F> { /* private fields */ }
Expand description

The actual provided Builder implementation. The various type parameters are used to swap out atomic/non-atomic AST versions.

Implementations§

Source§

impl<T, W, C, F> CoreBuilder<T, W, C, F>

Source

pub fn new() -> Self

Constructs a builder.

Trait Implementations§

Source§

impl<T, W, C, F> Builder for CoreBuilder<T, W, C, F>

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>

Constructs a Command::Job node with the provided inputs if the command was delimited by an ampersand or the command itself otherwise.

Source§

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

Constructs a Command::List node with the provided inputs.

Source§

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

Constructs a Command::Pipe node with the provided inputs or a Command::Simple node if only a single command with no status inversion is supplied.

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>

Constructs a Command::Simple node with the provided inputs.

Source§

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

Constructs a CompoundCommand::Brace node with the provided inputs.

Source§

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

Constructs a CompoundCommand::Subshell node with the provided inputs.

Source§

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

Constructs a CompoundCommand::Loop node with the provided inputs.

Source§

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

Constructs a CompoundCommand::If node with the provided inputs.

Source§

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

Constructs a CompoundCommand::For node with the provided inputs.

Source§

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

Constructs a CompoundCommand::Case node with the provided inputs.

Source§

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

Converts a CompoundCommand into a PipeableCommand.

Source§

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

Constructs a Command::FunctionDef node with the provided inputs.

Source§

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

Ignored by the builder.

Source§

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

Constructs a ast::Word from the provided input.

Source§

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

Constructs a ast::Redirect from the provided input.

Source§

type Command = C

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

type CommandList = AndOrList<<CoreBuilder<T, W, C, F> as Builder>::ListableCommand>

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

type ListableCommand = ListableCommand<<CoreBuilder<T, W, C, F> 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, W, Redirect<W>>>, Box<CompoundCommand<CompoundCommandKind<T, W, C>, Redirect<W>>>, F>

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

type CompoundCommand = CompoundCommand<CompoundCommandKind<T, <CoreBuilder<T, W, C, F> as Builder>::Word, <CoreBuilder<T, W, C, F> as Builder>::Command>, Redirect<<CoreBuilder<T, W, C, F> as Builder>::Word>>

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

type Word = W

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

type Redirect = Redirect<<CoreBuilder<T, W, C, F> as Builder>::Word>

The type which represents a file descriptor redirection.
Source§

type Error = Void

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

impl<T, W, C, F> Clone for CoreBuilder<T, W, C, F>

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, W, C, F> Debug for CoreBuilder<T, W, C, F>

Source§

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

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

impl<T, W, C, F> Default for CoreBuilder<T, W, C, F>

Source§

fn default() -> Self

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

impl<T, W, C, F> Copy for CoreBuilder<T, W, C, F>

Auto Trait Implementations§

§

impl<T, W, C, F> Freeze for CoreBuilder<T, W, C, F>

§

impl<T, W, C, F> RefUnwindSafe for CoreBuilder<T, W, C, F>

§

impl<T, W, C, F> Send for CoreBuilder<T, W, C, F>
where T: Send, W: Send, C: Send, F: Send,

§

impl<T, W, C, F> Sync for CoreBuilder<T, W, C, F>
where T: Sync, W: Sync, C: Sync, F: Sync,

§

impl<T, W, C, F> Unpin for CoreBuilder<T, W, C, F>
where T: Unpin, W: Unpin, C: Unpin, F: Unpin,

§

impl<T, W, C, F> UnwindSafe for CoreBuilder<T, W, C, F>

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.