tabled/grid/records/into_records/
either_string.rs

1//! A module with a utility enum [`EitherString`].
2
3/// Either allocated string or some type which can be used as a string.
4#[derive(Debug)]
5pub enum EitherString<T> {
6    /// Allocated string.
7    Owned(String),
8    /// Something which can be used as a string.
9    Some(T),
10}
11
12impl<T> AsRef<str> for EitherString<T>
13where
14    T: AsRef<str>,
15{
16    fn as_ref(&self) -> &str {
17        match self {
18            EitherString::Owned(s) => s.as_ref(),
19            EitherString::Some(s) => s.as_ref(),
20        }
21    }
22}