1pub(crate) trait NoneIfEmpty { 2 fn none_if_empty(self) -> Self; 3} 4 5impl NoneIfEmpty for Option<String> { 6 fn none_if_empty(self) -> Self { 7 self.and_then(|value| if value.is_empty() { None } else { Some(value) }) 8 } 9}