pub struct CommandTemplate { /* private fields */ }Expand description
A declared command parsed into an executable argv with named holes.
Implementations§
Source§impl CommandTemplate
impl CommandTemplate
Sourcepub fn parse(command: &str) -> Result<Self, TemplateError>
pub fn parse(command: &str) -> Result<Self, TemplateError>
Parse a declared command into a program and its arguments.
Words are split on unquoted whitespace. Single quotes take their
contents literally, including $. Double quotes group text into one
word while still substituting parameters. A parameter is written $name
or ${name}; $$ is a literal $.
§Errors
Returns TemplateError when the command is empty, a quote or ${ is
unterminated, a $ names no parameter, or the program position is a
parameter reference.
Sourcepub fn referenced_parameters(&self) -> Vec<String>
pub fn referenced_parameters(&self) -> Vec<String>
The parameter names this command references, in sorted order.
Sourcepub fn render(
&self,
values: &BTreeMap<String, Value>,
) -> Result<Vec<String>, SubstitutionError>
pub fn render( &self, values: &BTreeMap<String, Value>, ) -> Result<Vec<String>, SubstitutionError>
Render the full argv, substituting values for parameter references.
The first element is the program; the rest are its arguments. Each element is one whole argument regardless of what a value contains.
§Errors
Returns SubstitutionError when a referenced parameter is absent or
its value has no unambiguous argument form.
Trait Implementations§
Source§impl Clone for CommandTemplate
impl Clone for CommandTemplate
Source§fn clone(&self) -> CommandTemplate
fn clone(&self) -> CommandTemplate
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CommandTemplate
impl Debug for CommandTemplate
impl Eq for CommandTemplate
Source§impl PartialEq for CommandTemplate
impl PartialEq for CommandTemplate
impl StructuralPartialEq for CommandTemplate
Auto Trait Implementations§
impl Freeze for CommandTemplate
impl RefUnwindSafe for CommandTemplate
impl Send for CommandTemplate
impl Sync for CommandTemplate
impl Unpin for CommandTemplate
impl UnsafeUnpin for CommandTemplate
impl UnwindSafe for CommandTemplate
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request