Skip to main content

Builder

Struct Builder 

Source
pub struct Builder<'a> { /* private fields */ }
Expand description

A catalog under construction.

Implementations§

Source§

impl<'a> Builder<'a>

Source

pub fn root(self, spec: Spec) -> Self

Attach a supplied plugin spec beneath the static root.

Source

pub fn under(self, parent: impl Into<String>, spec: Spec) -> Self

Attach a supplied plugin spec beneath a static command path.

Components may use visible or hidden static aliases; construction stores the canonical path. The parent must declare an external-subcommand catch-all.

Source

pub const fn completions(self, overlays: &'a [CompletionOverlay<'a>]) -> Self

Register the host’s own completion callbacks, as usage_argv::complete::App::completions would.

Words before a runtime command are the host’s, and the host’s engine answers for them — so whatever it was given, it keeps.

Source

pub const fn project(self, command_path: &'a str) -> Self

Answer as though this command path came after argv0, for a multicall binary.

The same projection usage_argv::complete::App::project applies, applied once, before anything asks where the words are.

Source

pub fn build(self) -> Result<Catalog<'a>, Error>

Validate every parent and name, and finish the catalog.

What is checked here is what the static tables can answer on their own: that the parent exists, that it invited runtime commands, and that no name collides. Assembling the merged tree is left to Catalog::app — dispatching a plugin command never needs it.

Trait Implementations§

Source§

impl<'a> Debug for Builder<'a>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for Builder<'a>

§

impl<'a> RefUnwindSafe for Builder<'a>

§

impl<'a> Send for Builder<'a>

§

impl<'a> Sync for Builder<'a>

§

impl<'a> Unpin for Builder<'a>

§

impl<'a> UnsafeUnpin for Builder<'a>

§

impl<'a> UnwindSafe for Builder<'a>

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> 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.