Folkert de Vries
no segfaults, ever!
fn main() {
println!("value is {}", *helper());
}
fn helper() -> &u64 {
let a = 42;
&a
}
error[E0106]: missing lifetime specifier
--> src/main.rs:5:16
|
5 | fn helper() -> &u64 {
| ^ expected named lifetime parameter
|
= help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
help: consider using the `'static` lifetime
|
5 | fn helper() -> &'static u64 {
| +++++++
For more information about this error, try `rustc --explain E0106`.
error: could not compile `playground` (bin "playground") due to previous error
fn main() {
println!("value is {}", *helper());
}
fn helper() -> &'static u64 {
let a = 42;
&a
}
error[E0515]: cannot return reference to local variable `a`
--> src/main.rs:7:5
|
7 | &a
| ^^ returns a reference to data owned by the current function
For more information about this error, try `rustc --explain E0515`.
one consistent format for all rust code everywhere
just works
it really just works
the fastest TLS implementation
"superuser do"
An AV1 decoder in Rust.
compression, codecs, critical infra
cortex_m
pac
hal
#![no_main]
#![no_std]
use embedded_hal::digital::v2::InputPin;
use embedded_hal::digital::v2::OutputPin;
use nrf52832_hal as hal;
use nrf52832_hal::gpio::Level;
use rtt_target::{rprintln, rtt_init_print};
#[panic_handler] // panicking behavior
fn panic(_: &core::panic::PanicInfo) -> ! {
loop {
cortex_m::asm::bkpt();
}
}
#[cortex_m_rt::entry]
fn main() -> ! {
rtt_init_print!();
let p = hal::pac::Peripherals::take().unwrap();
let port0 = hal::gpio::p0::Parts::new(p.P0);
let button = port0.p0_13.into_pullup_input();
let mut led = port0.p0_17.into_push_pull_output(Level::Low);
rprintln!("Blinky button demo starting");
loop {
if button.is_high().unwrap() {
led.set_high().unwrap();
} else {
led.set_low().unwrap();
}
}
}
#![no_main]
#![no_std]
use embedded_hal::digital::v2::InputPin;
use embedded_hal::digital::v2::OutputPin;
use nrf52832_hal as hal;
use nrf52832_hal::gpio::Level;
use rtt_target::{rprintln, rtt_init_print};
#[panic_handler] // panicking behavior
fn panic(_: &core::panic::PanicInfo) -> ! {
loop {
cortex_m::asm::bkpt();
}
}
#[cortex_m_rt::entry]
fn main() -> ! {
rtt_init_print!();
let p = hal::pac::Peripherals::take().unwrap();
let port0 = hal::gpio::p0::Parts::new(p.P0);
let button = port0.p0_13.into_pullup_input();
let mut led = port0.p0_17.into_push_pull_output(Level::Low);
rprintln!("Blinky button demo starting");
loop {
if button.is_high().unwrap() {
led.set_high().unwrap();
} else {
led.set_low().unwrap();
}
}
}
packages/traits make code sharing almost trivial
tooling is excellent and not tied to a particular company