git-iblame 0.8.10

Interactive enhanced `git blame` command line tool.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use std::borrow::Cow;

pub trait OrDefault<U> {
    fn or_default(&self) -> U;
}

impl OrDefault<Cow<'static, str>> for Option<&String> {
    fn or_default(&self) -> Cow<'static, str> {
        (*self).map_or("".into(), |s| s.to_string().into())
    }
}

impl OrDefault<Cow<'static, str>> for Option<String> {
    fn or_default(&self) -> Cow<'static, str> {
        self.as_ref().or_default()
    }
}