Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fn test<T: AsRef<[u8]> + 'static>(v: T) {
- let r: &[u8] = v.as_ref();
- println!("{:?}", r);
- }
- fn main() {
- let vec: Vec<u8> = vec![1, 2, 3, 4];
- test(vec);
- let arr_ref: &[u8] = &[5, 6, 7, 8];
- test(arr_ref);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement