| Crates.io | break-block-macro |
| lib.rs | break-block-macro |
| version | 0.1.0 |
| created_at | 2024-04-29 06:14:58.729187+00 |
| updated_at | 2024-04-29 06:14:58.729187+00 |
| description | A little syntactic sugar to tide us over until the `?` operator can be used to exit try-catch scopes |
| homepage | |
| repository | https://github.com/luketpeterson/break-block-macro/ |
| max_upload_size | |
| id | 1223866 |
| size | 3,797 |
A little syntactic sugar to tide us over until the ? operator can be used to exit try-catch scopes
The bb macro behaves like the ? operator, but will break out of labeled scopes to achieve something that resembles try-catch.
See this issue for background.
use break_block_macro::bb;
let result = 'block: {
let one = bb!(Ok("one"));
assert_eq!(one, "one");
let _two = bb!(Err("two"));
Ok("three")
};
assert_eq!(result, Err("two"));