SHARE
TWEET

Untitled

a guest Jun 16th, 2019 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. fn test<T: AsRef<[u8]> + 'static>(v: T) {
  2.     let r: &[u8] = v.as_ref();
  3.     println!("{:?}", r);
  4. }
  5.  
  6.  
  7. fn main() {
  8.  
  9.     let vec: Vec<u8> = vec![1, 2, 3, 4];
  10.     test(vec);
  11.    
  12.     let arr_ref: &[u8] = &[5, 6, 7, 8];
  13.     test(arr_ref);
  14.    
  15. }
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