Change from try (reserved keyword) to maybe

This commit is contained in:
Mikayla 2023-10-25 07:10:21 -07:00
parent beb0af9763
commit 26a3d41dc7
No known key found for this signature in database
7 changed files with 22 additions and 22 deletions

View file

@ -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(())
});