caret: work correctly when there are no defined variants.
This commit is contained in:
parent
d69ed3bc62
commit
841905948f
|
@ -107,8 +107,10 @@ macro_rules! caret_int {
|
||||||
}
|
}
|
||||||
/// Return true if this value is one that we recognize.
|
/// Return true if this value is one that we recognize.
|
||||||
$v fn is_recognized(self) -> bool {
|
$v fn is_recognized(self) -> bool {
|
||||||
matches!(self,
|
match self {
|
||||||
$( $name::$id )|*)
|
$( $name::$id => true, )*
|
||||||
|
_ => false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/// Try to convert this value from one of the recognized names.
|
/// Try to convert this value from one of the recognized names.
|
||||||
$v fn from_name(name: &str) -> Option<Self> {
|
$v fn from_name(name: &str) -> Option<Self> {
|
||||||
|
|
Loading…
Reference in New Issue