You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wrote a little derive macro that generates is_* methods for each enum variant, and I wonder if strum would be a good home for it. If so, I'll open a PR.
Example:
#[derive(Is)]enumFoo{Bar{},Biz}
The Is derive will add is_bar() and is_biz() methods, similar to Option::is_some(), Option::is_none(), Result::is_ok(), etc.
I think that:
if foo.is_bar(){
....
}
is a lot cleaner then:
ifmatches!(foo, Foo::Bar{ .. }){
....
}
Thoughts?
The text was updated successfully, but these errors were encountered:
I wrote a little derive macro that generates
is_*
methods for each enum variant, and I wonder if strum would be a good home for it. If so, I'll open a PR.Example:
The
Is
derive will addis_bar()
andis_biz()
methods, similar toOption::is_some()
,Option::is_none()
,Result::is_ok()
, etc.I think that:
is a lot cleaner then:
Thoughts?
The text was updated successfully, but these errors were encountered: