SHARE
TWEET

Untitled

a guest Oct 23rd, 2019 81 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. mod private {
  2.     /// Yay, type safety.
  3.     #[derive(Debug)]
  4.     pub enum Mark {
  5.         /// Neat-o
  6.         Neat,
  7.         /// Cool
  8.         Cool { a: u32 },
  9.     }
  10. }
  11. pub use private::Mark::*;
  12.  
  13. enum _Private {
  14.     Fail,
  15.     Aw,
  16. }
  17.  
  18. // error: enum is private and its variants cannot be re-exported
  19. // pub use _Private::*;
  20.  
  21. pub fn test(thing: private::Mark) {
  22.     dbg!(thing);
  23. }
  24.  
  25. fn main() {
  26.     test(Neat);
  27.     test(Cool { a: 3 });
  28.     // test(Mark::Neat);
  29. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top