Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fn take_if<T, P>(o: &mut Option<T>, mut pred: P) -> Option<T>
- where
- P: FnOnce(&T) -> bool,
- {
- match o {
- Some(x) if pred(&x) => o.take(),
- _ => None,
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement