From 8f5353f6f59c0fd4687f1c3d00590ff567cd4391 Mon Sep 17 00:00:00 2001 From: rusty-snake Date: Wed, 4 Sep 2019 18:01:39 +0000 Subject: [PATCH] more ticks in bail-and-ensure.md --- book/src/bail-and-ensure.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/book/src/bail-and-ensure.md b/book/src/bail-and-ensure.md index 1326f0e..37411ba 100644 --- a/book/src/bail-and-ensure.md +++ b/book/src/bail-and-ensure.md @@ -1,6 +1,6 @@ # `bail!` and `ensure!` -If you were a fan of the `bail!` and ensure! macros from error-chain, good news. failure has a version of these macros as well. +If you were a fan of the `bail!` and `ensure!` macros from error-chain, good news. failure has a version of these macros as well. The `bail!` macro returns an error immediately, based on a format string. The `ensure!` macro additionally takes a conditional, and returns the error only if that conditional is false. You can think of `bail!` and `ensure!` as being analogous to `panic!` and `assert!`, but throwing errors instead of panicking. @@ -15,4 +15,4 @@ fn safe_cast_to_unsigned(n:i32) -> Result ensure!(n>=0, "number cannot be smaller than 0!"); (u32) n } -``` \ No newline at end of file +```