Guest User

Untitled

a guest
Jul 20th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. #![feature(nll)]
  2. #![allow(dead_code)]
  3.  
  4. struct List {
  5. next: Option<Box<List>>,
  6. }
  7.  
  8. impl List {
  9. fn walk_the_list(&self) {
  10. let mut current = self;
  11. while let Some(inner) = &current.next {
  12. current = inner;
  13. }
  14. }
  15.  
  16. fn consume_the_list(self) {
  17. self.walk_the_list();
  18. }
  19. }
  20.  
  21. fn main() {}
Add Comment
Please, Sign In to add comment