Skip to main content

InputCollector

Trait InputCollector 

Source
pub trait InputCollector<T>: Send + Sync {
    // Required methods
    fn name(&self) -> &'static str;
    fn is_available(&self, matches: &ArgMatches) -> bool;
    fn collect(&self, matches: &ArgMatches) -> Result<Option<T>, InputError>;

    // Provided methods
    fn bind_sources(
        &self,
        _sources: &InputSources,
    ) -> Option<Box<dyn InputCollector<T>>> { ... }
    fn validate(&self, _value: &T) -> Result<(), String> { ... }
    fn can_retry(&self) -> bool { ... }
}

Required Methods§

Source

fn name(&self) -> &'static str

Source

fn is_available(&self, matches: &ArgMatches) -> bool

Source

fn collect(&self, matches: &ArgMatches) -> Result<Option<T>, InputError>

Provided Methods§

Source

fn bind_sources( &self, _sources: &InputSources, ) -> Option<Box<dyn InputCollector<T>>>

Source

fn validate(&self, _value: &T) -> Result<(), String>

Source

fn can_retry(&self) -> bool

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§