From 48b798020e7a43eae1ea4c0666055892d1f9b5a8 Mon Sep 17 00:00:00 2001 From: Andres Vahter Date: Wed, 25 Sep 2019 16:32:56 +0300 Subject: [PATCH] Add missing `` to ensure! macro --- 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 +```