cashmere

cashmere

rust match with continue

Preface

Here is what I like to call "match with continue," which I found by accident. Basically, it is somewhat of a try-catch. Nevertheless, since I like it, I want to present it.

Example

match db.checkout_service.save_checkout(checkout.clone()).await {
    Ok(_) => {}
    Err(e) => {
        return Err(ErrorUnauthorized(e.to_string()));
    }
}

References