Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

try and catch in rust

fn main() {
    let do_steps = || -> Result<(), MyError> {
        do_step_1()?;
        do_step_2()?;
        do_step_3()?;
        Ok(())
    };

    if let Err(_err) = do_steps() {
        println!("Failed to perform necessary steps");
    }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #catch #rust
ADD COMMENT
Topic
Name
4+7 =