Skip to main content

IdPathProvider

Trait IdPathProvider 

Source
pub trait IdPathProvider {
    // Required method
    fn get_ids(matches: &ArgMatches<'_>) -> Result<Option<Vec<StoreId>>>;
}
Expand description

A trait for providing ids from clap argument matches

This trait can be implement on a type so that it can provide IDs when given a ArgMatches object. It can be used with Runtime::ids(), and libimagrt handles “stdin-provides-ids” cases automatically:

runtime.ids::<PathProvider>()?.iter().for_each(|id| /* ... */)

libimagrt does not call the PathProvider if the ids are provided by piping to stdin.

§Passed arguments

The arguments which are passed into the IdPathProvider::get_ids() function are the top level ArgMatches. Traversing might be required in the implementation of the ::get_ids() function.

§Returns

In case no store ids could be matched, the function should return Ok(None) instance. On success, the StoreId objects to operate on are returned from the ArgMatches. Otherwise, an appropriate error may be returned.

Required Methods§

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§