SHARE
TWEET

Untitled

a guest Oct 15th, 2019 76 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. pub enum EntryOutcome {
  2.     Warning(Warning),
  3.     Error(Error),
  4. }
  5.  
  6. impl<T> From<T> for EntryOutcome where Warning: From<T> {
  7.     fn from(warn: T) -> Self {
  8.         Self::Warning(warn.into())
  9.     }
  10. }
  11.  
  12. impl<T> From<T> for EntryOutcome where Error: From<T> {
  13.     fn from(err: T) -> Self {
  14.         Self::Error(err.into())
  15.     }
  16. }
  17.  
  18. pub enum Warning {
  19.     Warning1,
  20.     // some other cases
  21. }
  22.  
  23. // some implementations of From<T> for Warning
  24.  
  25. pub enum Error {
  26.     Error1,
  27.     // some other cases
  28. }
  29.  
  30. // some implementations of From<T> for Error
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