About
Error handling snippets.
Usage
Ignoring Errors
# Simple Example let res: Result<u8, ()> = Ok(42); let opt: Option<u8> = res.ok(); println!("{:?}", opt); # Nested Example MsgSender::new(name.to_string()) .with_timepoint(sim_time(timestamp)) .with_component(&[Box3D::new(length / 2.0, width / 2.0, height / 2.0)]).ok() .with_component(&[rerun_transform]).ok() .with_component(&[ColorRGBA::from_rgb(r, g, b)]).ok() .with_component(&[Radius(0.005)]).ok() .with_component(&[Label(name.to_string().to_owned())]).ok() .send(session).ok();
Collecting Errors
# Nested Example - Get the First Error let v = vec![1]; let result = v.iter().map(| | MsgSender::new(name.to_string()) .with_timepoint(sim_time(timestamp)) .with_component(&[Box3D::new(length / 2.0, width / 2.0, height / 2.0)])? .with_component(&[rerun_transform])? .with_component(&[ColorRGBA::from_rgb(r, g, b)])? .with_component(&[Radius(0.005)])? .with_component(&[Label(name.to_string().to_owned())])? .send(session)? ).collect(); match result { Ok(_) => (), Err(e) => println!("WARN: Failed to send 'bounding box' to the viz session [{:?}]", e) }