std_ext/option/
string.rs

1
2
3
4
5
6
7
8
9
pub trait OptionStringExt {
    fn as_str(&self) -> &str;
}

impl OptionStringExt for Option<String> {
    fn as_str(&self) -> &str {
        self.as_deref().unwrap_or_default()
    }
}