Currently, if we want to use an extensible enum, we can define it as what std::io::Error
does
pub enum ErrorKind {
NotFound,
PermissionDenied,
...,
#[doc(hidden)]
__Nonexhaustive,
}
Personally, I don’t like this, because it is more like a hack rather than a formal syntax. Do we have any proposals on extensible enums?
Perhaps we can use _
as a variant in the extensible enums:
pub enum ErrorKind {
NotFound,
PermissionDenied,
...,
_,
}