Spec

Struct Spec 

Source
pub struct Spec {
    pub options: GenerationOptions,
    pub actions: Vec<CompleteAction>,
    pub glob_pattern: Option<String>,
    pub word_list: Option<String>,
    pub function_name: Option<String>,
    pub command: Option<String>,
    pub filter_pattern: Option<String>,
    pub filter_pattern_excludes: bool,
    pub prefix: Option<String>,
    pub suffix: Option<String>,
}
Expand description

Encapsulates a command completion specification; provides policy for how to generate completions for a given input.

Fields§

§options: GenerationOptions

Options to use for completion.

§actions: Vec<CompleteAction>

Actions to take to generate completions.

§glob_pattern: Option<String>

Optionally, a glob pattern whose expansion will be used as completions.

§word_list: Option<String>

Optionally, a list of words to use as completions.

§function_name: Option<String>

Optionally, the name of a shell function to invoke to generate completions.

§command: Option<String>

Optionally, the name of a command to execute to generate completions.

§filter_pattern: Option<String>

Optionally, a pattern to filter completions.

§filter_pattern_excludes: bool

If true, completion candidates matching filter_pattern are removed; otherwise, those not matching it are removed.

§prefix: Option<String>

Optionally, provides a prefix to be prepended to all completion candidates.

§suffix: Option<String>

Optionally, provides a suffix to be prepended to all completion candidates.

Implementations§

Source§

impl Spec

Source

pub async fn get_completions( &self, shell: &mut Shell, context: &Context<'_>, ) -> Result<Answer, Error>

Generates completion candidates using this specification.

§Arguments
  • shell - The shell instance to use for completion generation.
  • context - The context in which completion is being generated.

Trait Implementations§

Source§

impl Clone for Spec

Source§

fn clone(&self) -> Spec

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 Debug for Spec

Source§

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

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

impl Default for Spec

Source§

fn default() -> Spec

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

Auto Trait Implementations§

§

impl Freeze for Spec

§

impl RefUnwindSafe for Spec

§

impl Send for Spec

§

impl Sync for Spec

§

impl Unpin for Spec

§

impl UnwindSafe for Spec

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

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> 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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more