1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
|
fn main() { let mut v: Vec<i32> = Vec::new(); vec.push(1); let v = vec![1,2,3];
{ let v1 = vec![1,2,3]; } let one: &i32 = &v[0]; println!("oen = {}",one); println!("one = {}",*one); match v.get(1) { Some(value) => println!("value = {}",value), _ => println!("None"), } println!("Hello, world!"); let mut v2: Vec<i32> = Vec::new(); v2.push(1); v2.push(2); v2.push(3);
for i in &v2 { println!("i = {}",i); } for i in &mut v2 { *i += 1; println!("i = {}",i); } enum Context { Text(String), Float(f32), Int(i32), };
let c = vec![ Context::Text(String::from("String")), Context::Int(-1), Context::Float(0,001) ]; let mut v = vec![1,2,3,4,5];
}
|