[−][src]Trait cmdtree::builder::BuilderChain
The common functions across a Builder
or a BuilderResult
.
See module level documentation for more information.
Required methods
fn begin_class(self, name: &str, help_msg: &'a str) -> BuilderResult<'a, R>
Start a new nested class. If the name already exists a BuildError
will be returned.
fn end_class(self) -> BuilderResult<'a, R>
Close a class and move to it's parent.
If no parent exists (this function is called on the root), a BuildError
will be returned.
fn add_action<F: FnMut(&mut dyn Write, &[&str]) -> R + Send + 'a>(
self,
name: &str,
help_msg: &'a str,
closure: F
) -> BuilderResult<'a, R>
self,
name: &str,
help_msg: &'a str,
closure: F
) -> BuilderResult<'a, R>
Add an action. The closure type gives the arguments after the action command as an array of strings.
fn root(self) -> BuilderResult<'a, R>
Navigates to the root class, closing out the classes as it goes.
fn into_commander<'c>(self) -> Result<Commander<'a, R>, BuildError>
Finishes the construction of the command tree and returns the build Commander
.
Note
This can be called even when not on a root class. The implmentation will continue to call end_class
until the root is reached,
short-circuiting the closing out process.
If an error is propogating through then the function will error. If there was no error (ie into_commander
was called on a Builder
instance)
then this function should not fail.
Implementors
impl<'a, R> BuilderChain<'a, R> for Builder<'a, R>
[src]
fn begin_class(self, name: &str, help_msg: &'a str) -> BuilderResult<'a, R>
[src]
fn end_class(self) -> BuilderResult<'a, R>
[src]
fn root(self) -> BuilderResult<'a, R>
[src]
fn add_action<F>(
self,
name: &str,
help_msg: &'a str,
closure: F
) -> BuilderResult<'a, R> where
F: FnMut(&mut dyn Write, &[&str]) -> R + Send + 'a,
[src]
self,
name: &str,
help_msg: &'a str,
closure: F
) -> BuilderResult<'a, R> where
F: FnMut(&mut dyn Write, &[&str]) -> R + Send + 'a,
fn into_commander<'c>(self) -> Result<Commander<'a, R>, BuildError>
[src]
impl<'a, R> BuilderChain<'a, R> for BuilderResult<'a, R>
[src]
fn begin_class(self, name: &str, help_msg: &'a str) -> BuilderResult<'a, R>
[src]
fn end_class(self) -> BuilderResult<'a, R>
[src]
fn root(self) -> BuilderResult<'a, R>
[src]
fn add_action<F: FnMut(&mut dyn Write, &[&str]) -> R + Send + 'a>(
self,
name: &str,
help_msg: &'a str,
closure: F
) -> BuilderResult<'a, R>
[src]
self,
name: &str,
help_msg: &'a str,
closure: F
) -> BuilderResult<'a, R>