Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pub mod parent {
- pub mod mod1 {
- pub struct Struct {}
- }
- pub mod mod2 {
- pub struct Struct {}
- }
- pub enum MyEnum {
- Struct1(mod1::Struct),
- Struct2(mod2::Struct),
- }
- impl std::convert::From<mod1::Struct> for MyEnum {
- fn from(s: mod1::Struct) -> Self {
- MyEnum::Struct1(s)
- }
- }
- }
- pub fn main() {
- let _foo = parent::MyEnum::from(parent::mod1::Struct {});
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement