I've already read this post, but that seems to talk about an issue that has been resolved (rust-lang/rust#56225).
Assuming this enum:
pub enum MyType {
Foo,
Bar,
Baz,
}
I can use either of these options to refer to the variants of MyType
:
impl MyType {
pub fn new_foo() -> Self {
Self::Foo
}
pub fn new_bar() -> Self {
use MyType::*;
Bar
}
}
However, attempting to combine the two methods fails:
impl MyType {
pub fn new_baz() -> Self {
use Self::*;
Baz
}
}
Why is this?