Unnamed repository; edit this file 'description' to name the repository.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use {
    std::{borrow::Cow, ops::Deref},
    text_size::*,
};

struct StringLike<'a>(&'a str);

impl Deref for StringLike<'_> {
    type Target = str;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}

#[test]
fn main() {
    let s = "";
    let _ = TextSize::of(&s);

    let s = String::new();
    let _ = TextSize::of(&s);

    let s = Cow::Borrowed("");
    let _ = TextSize::of(&s);

    let s = Cow::Owned(String::new());
    let _ = TextSize::of(&s);

    let s = StringLike("");
    let _ = TextSize::of(&s);
}