Guest User

Untitled

a guest
Jan 23rd, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.19 KB | None | 0 0
  1. #![allow(unused)]
  2. fn add_one<T: AsMut<u64>>(num: &mut T) {
  3. *num.as_mut() += 1;
  4. }
  5.  
  6. fn main() {
  7. let mut boxed_num = Box::new(0);
  8. add_one(&mut boxed_num);
  9. assert_eq!(*boxed_num, 1);
  10. }
Add Comment
Please, Sign In to add comment