|
/// Also perform WiFi Geolocation if it is enabled. Return 0 if successful. |
|
pub fn start_network_task() -> i32 { |
|
console_print(b"start_network_task\n"); |
|
0 |
|
} |
Immediatly as I saw the video in the medium post I shuddered.
Do proper error handling in Rust!
Don't return ints to indicate errors or failures, use Result<(), ErrorType> instead. This is just one place, but everywhere where you have those ghastly assert!(rc == 0) things, throw them away and burn them! Either use unwrap, or better expect.
stm32bluepill-mynewt-sensor/src/send_coap.rs
Lines 19 to 23 in f51e078
Immediatly as I saw the video in the medium post I shuddered.
Do proper error handling in Rust!
Don't return
ints to indicate errors or failures, useResult<(), ErrorType>instead. This is just one place, but everywhere where you have those ghastlyassert!(rc == 0)things, throw them away and burn them! Either useunwrap, or betterexpect.