Created
July 6, 2025 17:01
-
-
Save JosiahParry/3d56d94bc40a345973f93dc105b65db2 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
pub trait Coalesce { | |
type Item; | |
fn coalesce(self, other: Option<Self::Item>) -> Option<Self::Item>; | |
} | |
impl<T> Coalesce for Option<T> { | |
type Item = T; | |
fn coalesce(self, other: Option<T>) -> Option<T> { | |
self.or(other) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment