Guest User

Untitled

a guest
Dec 11th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. struct Peripherals {
  2. serial0: Option<Uart0>,
  3. serial1: Option<Uart1>,
  4. }
  5.  
  6. struct Uart0;
  7. struct Uart1;
  8.  
  9. impl Peripherals {
  10. fn take_serial0(&mut self) -> Uart0 {
  11. // let s = Option::replace(&mut self.serial0, None);
  12. let s = Option::replace(&mut self.serial0, None);
  13. s.unwrap()
  14. }
  15. }
  16.  
  17. static S32G2XX_PERIFS: Peripherals = Peripherals{
  18. serial0: Some(Uart0),
  19. serial1: Some(Uart1),
  20. };
  21.  
  22. fn main() {}
Add Comment
Please, Sign In to add comment