-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lib: add try_take! macro, handling AlreadyUsed Options
In several places we represent something that could be consumed as an `Option<T>`. When we try to use it, we `take()` the option, match the result, and return `rustls_result::AlreadyUsed` if `take()` returned `None`. Since this pattern is becoming more common with the use of more builder patterns this commit adds a `try_take!` macro that can do this repetitive work for us.
- Loading branch information
Showing
3 changed files
with
20 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters