daily pastebin goal
59%
SHARE
TWEET

Untitled

a guest Jan 23rd, 2019 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top