Advertisement
Guest User

Untitled

a guest
Sep 19th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. struct Foo;
  2.  
  3. fn test<'a>(a: &'a mut Foo) -> &'a mut Foo {
  4. loop {
  5. if foo(a).is_some() {
  6. return a;
  7. }
  8. }
  9. }
  10.  
  11.  
  12.  
  13. fn foo<'a>(a: &'a mut Foo) -> Option<&'a mut Foo> {
  14. if rand::random::<bool>() { Some(a) } else { None }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement