Lifetimes
Does this crate work when a member of the enum needs a lifetime? As an example:
#[enum_dispatch(Matcher)]
pub enum KnownMatcher<'a> {
Printer(printer::Printer),
True(logical_matchers::TrueMatcher),
False(logical_matchers::FalseMatcher),
Name(name::NameMatcher),
CaselessName(name::CaselessNameMatcher),
Type(type_matcher::TypeMatcher),
Newer(time::NewerMatcher),
FileTime(time::FileTimeMatcher),
Size(size::SizeMatcher),
SingleExec(exec::SingleExecMatcher<'a>),
Perm(perm::PermMatcher),
Prune(prune::PruneMatcher),
}
The above errors out with this:
82 | pub enum KnownMatcher<'a> {
| ^^^^^^^^^^^^ expected lifetime parameter
error[E0106]: missing lifetime specifier
--> src/find/matchers/mod.rs:82:10
|
82 | pub enum KnownMatcher<'a> {
| ^^^^^^^^^^^^ help: consider giving it an explicit bounded or 'static lifetime: `KnownMatcher + 'static`
|
= help: this function's return type contains a borrowed value with an elided lifetime, but the lifetime cannot be derived from the arguments
error[E0261]: use of undeclared lifetime name `'a`
--> src/find/matchers/mod.rs:92:40
|
92 | SingleExec(exec::SingleExecMatcher<'a>),
| ^^ undeclared lifetime
error: aborting due to 3 previous errors
Edited by Alex Lyon