[−][src]Trait spirit::fragment::Extractor
A trait describing something that extracts a fragment from configuration and command line options.
The extractor is used every time a Pipeline
is triggered, to get the
fragment out.
Usually, an extractor is a closure, but something else can implement the trait too.
Users usually don't need to interact with this trait directly.
Note that the extractor is lifetime-parametric. Usually the real extractor implements the trait
for all lifetimes (and it is not useful otherwise). This allows returning references into the
configuration, the Pipeline
is able to work with that (given new enough rustc
‒ there
were some bugs preventing it from working; if that's the case, you can clone and return owned
values).
Associated Types
Loading content...Required methods
fn extract(&mut self, opts: &'a O, config: &'a C) -> Self::Fragment
The actual call of the extractor.
The extractor is allowed to either reference into the configuration (or command line options) or create something new out of it (including structures containing references there).
It is not uncommon to combine information from both to form a fragment.
Implementors
impl<'a, O, C: 'a, F, R> Extractor<'a, O, C> for CfgExtractor<F> where
F: FnMut(&'a C) -> R,
R: Fragment + 'a,
[src]
F: FnMut(&'a C) -> R,
R: Fragment + 'a,
impl<'a, O: 'a, C: 'a, F, R> Extractor<'a, O, C> for F where
F: FnMut(&'a O, &'a C) -> R,
R: Fragment + 'a,
[src]
F: FnMut(&'a O, &'a C) -> R,
R: Fragment + 'a,