how.rs/examples/output.rs

23 lines
692 B
Rust

use how::*;
fn main0() -> Result<()> {
Err(How::new(
"The engine broke down"
.with("Remember: you aren't good with cars")
.with("Suggestion: call a tow truck")
.with("Foo".with("Bar").with("Baz"))
.with("Foo\nBar"),
)
.context(
"While driving down a road"
.with(format!("Where the road is {}", "Main Street"))
.with(format!("And the speed is {}", "86 km/h")),
)
.context("While driving to a location".with(format!("Where the location is {}", "the Mall")))
.context(format!("While in the car with {:?}", ["Mom", "Dad"])))?
}
fn main() -> TerminationResult {
main0().into()
}