Change from try (reserved keyword) to maybe
This commit is contained in:
parent
beb0af9763
commit
26a3d41dc7
7 changed files with 22 additions and 22 deletions
|
@ -349,19 +349,19 @@ pub fn unzip_option<T, U>(option: Option<(T, U)>) -> (Option<T>, Option<U>) {
|
|||
}
|
||||
}
|
||||
|
||||
/// Immediately invoked function expression. Good for using the ? operator
|
||||
/// Evaluates to an immediately invoked function expression. Good for using the ? operator
|
||||
/// in functions which do not return an Option or Result
|
||||
#[macro_export]
|
||||
macro_rules! try {
|
||||
macro_rules! maybe {
|
||||
($block:block) => {
|
||||
(|| $block)()
|
||||
};
|
||||
}
|
||||
|
||||
/// Async Immediately invoked function expression. Good for using the ? operator
|
||||
/// in functions which do not return an Option or Result. Async version of above
|
||||
/// Evaluates to an immediately invoked function expression. Good for using the ? operator
|
||||
/// in functions which do not return an Option or Result, but async.
|
||||
#[macro_export]
|
||||
macro_rules! async_try {
|
||||
macro_rules! async_maybe {
|
||||
($block:block) => {
|
||||
(|| async move { $block })()
|
||||
};
|
||||
|
@ -434,7 +434,7 @@ mod tests {
|
|||
None
|
||||
}
|
||||
|
||||
let foo = iife!({
|
||||
let foo = maybe!({
|
||||
option_returning_function()?;
|
||||
Some(())
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue