Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUST

rust swap vector elements

fn main() {
    let mut numbers = vec![1, 2, 3];
    println!("before = {:?}", numbers);
    numbers.swap(0, 2);
    println!("after = {:?}", numbers);
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #rust #swap #vector #elements
ADD COMMENT
Topic
Name
9+7 =