dofus_framework/ext/
option_ext.rs1pub trait OptionExt<T> {
2 fn if_present<E: Fn(&T)>(&self, action: E);
3}
4
5impl<T> OptionExt<T> for Option<T> {
6 fn if_present<E: Fn(&T)>(&self, action: E) {
7 if let Some(value) = self {
8 action(value);
9 }
10 }
11}