Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUST

rust vector insert

/// Construction:
//  vector.insert(index: usize, element: T);
//  
/// Example:
fn main() {
    let mut v = vec![1,3];  //  create mutable vector
    v.insert(1,2);          //  insert 2 on index 1
    println!("{v:?}");      //  print result in the console
}
///	Output:
//	[1, 2, 3]
Source by doc.rust-lang.org #
 
PREVIOUS NEXT
Tagged: #rust #vector #insert
ADD COMMENT
Topic
Name
4+5 =