rxpect 0.10.0

Extensible fluent expectations for Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/// A simpler version of Cow that can only borrow values, not convert them into owned.
pub enum BorrowedOrOwned<'a, T> {
    Borrowed(&'a T),
    Owned(T),
}

impl<'a, T> BorrowedOrOwned<'a, T> {
    /// Borrows this value with a lifetime that matches self
    pub fn borrow_self(&'a self) -> &'a T {
        match self {
            BorrowedOrOwned::Borrowed(reference) => reference,
            BorrowedOrOwned::Owned(owned) => owned,
        }
    }
}