pub trait TakeWhen<T> {
	fn take_when(&mut self, f: impl FnOnce(&T) -> bool) -> Option<T>;
}
impl<T> TakeWhen<T> for Option<T> {
	fn take_when(&mut self, f: impl FnOnce(&T) -> bool) -> Option<T> {
		match &self {
			Some(x) if f(x) => self.take(),
			_ => None,
		}
	}
}
