Advertisement
Guest User

Untitled

a guest
Jul 18th, 2019
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. pub mod parent {
  2. pub mod mod1 {
  3. pub struct Struct {}
  4. }
  5. pub mod mod2 {
  6. pub struct Struct {}
  7. }
  8. pub enum MyEnum {
  9. Struct1(mod1::Struct),
  10. Struct2(mod2::Struct),
  11. }
  12. impl std::convert::From<mod1::Struct> for MyEnum {
  13. fn from(s: mod1::Struct) -> Self {
  14. MyEnum::Struct1(s)
  15. }
  16. }
  17. }
  18.  
  19. pub fn main() {
  20. let _foo = parent::MyEnum::from(parent::mod1::Struct {});
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement