Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #![feature(nll)]
- #![allow(dead_code)]
- struct List {
- next: Option<Box<List>>,
- }
- impl List {
- fn walk_the_list(&mut self) {
- let mut current = self;
- loop {
- match current.next {
- None => return,
- Some(ref mut inner) => current = inner,
- }
- }
- }
- fn consume_the_list(mut self) {
- self.walk_the_list();
- }
- }
- fn main() {}
Add Comment
Please, Sign In to add comment