Yannick
Guern
https://lafor.ge
@_Akanoa_
Rust can run without the rust-std, useful for embedded compilation (Β΅ Controllers, device drivers, IOT, ...)
The STD increases the weight of the final artifact
Editions
Compile rust sources for a wide range of targets:
What does it do ?
Benefits
Β
[package]
name = "toto"
version = "0.0.1"
edition = "2021"
[dependencies]
tokio = "^1.28"
Extends cargo behaviors with useful utils
// incomplete range
let a = 'a' .. 'z';
// completed range
let a = 'a' ..= 'z'
// init
let mut a = 1;
let b = 2;
// repetition
a = a + b;
// better
a += b;
// useless reallocations
let mut vec1 = Vec::with_capacity(len);
vec1.resize(len, 0);
let mut vec1 = Vec::with_capacity(len);
vec1.resize(vec1.capacity(), 0);
let mut vec2 = Vec::with_capacity(len);
vec2.extend(repeat(0).take(len));
// much better
let mut vec1 = vec![0; len];
let mut vec2 = vec![0; len];
// useless indirection
Box<Vec<Foo>>
// much better
Vec<Foo>
loop {
let x = match y {
Some(x) => x,
None => break,
};
// .. do something with x
}
// is easier written as
while let Some(x) = y {
// .. do something with x
};
@_Akanoa_
https://lafor.ge