Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fn main() {
- let x = vec![1u8, 2u8, 3u8];
- let y = &x; // the vector was "borrowed"
- let c = x.clone(); // Explicit copy
- println!("x is {:?}", x);
- println!("y is {:?}", *y);
- fn abc(x: &Vec<u8>) {
- // do something
- }
- let myvec = vec![1u8,2u8,3u8];
- abc(&myvec); // Passes a borrowed reference
- // Still can use myvec here
- }
Add Comment
Please, Sign In to add comment