Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

create empty vector in rust

///Creates and returns empty vector
vec![]

///Creates and returns vector of length 'l' with default value 'v'
vec![v; l] /// vec![0; 3] returns [0,0,0]

///Creates and returns vector of length 'l' with default value 'v' of datatype 'T'
vec![vT; l]; /// vec![3u8; 2] returns [3, 3] 

///Creates empty vector with specific type 'T' and capacity 'c'
Vec::<T>::with_capacity(c)
Source by doc.rust-lang.org #
 
PREVIOUS NEXT
Tagged: #create #empty #vector #rust
ADD COMMENT
Topic
Name
1+9 =