Skip to content

A little syntactic sugar to tide us over until the `?` operator can be used to exit try-catch scopes

Notifications You must be signed in to change notification settings

luketpeterson/break-block-macro

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

break-block-macro

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.

Usage

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"));

About

A little syntactic sugar to tide us over until the `?` operator can be used to exit try-catch scopes

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages