2016 Update

This commit is contained in:
Tina Müller 2016-12-05 22:15:40 +01:00
parent 948b86eafa
commit dcf5d15da3
7965 changed files with 139854 additions and 31002 deletions

View file

@ -0,0 +1,2 @@
let a = [1u8,2,3,4,5]; // a is of type [u8; 5];
let b = [0;256] // Equivalent to `let b = [0,0,0,0,0,0... repeat 256 times]`

View file

@ -0,0 +1,3 @@
let array = [1,2,3,4,5];
let slice = &array[0..2]
println!("{:?}", slice);

View file

@ -0,0 +1,6 @@
let mut v = Vec::new();
v.push(1);
v.push(2);
v.push(3);
// Or (mostly) equivalently via a convenient macro in the standard library
let v = vec![1,2,3];

View file

@ -0,0 +1,4 @@
let x = "abc"; // x is of type &str (a borrowed string slice)
let s = String::from(x);
// or alternatively
let s = x.to_owned();