re_types_core/datatypes/
utf8_ext.rs

1use super::Utf8;
2
3impl Utf8 {
4    #[inline]
5    pub fn as_str(&self) -> &str {
6        self.0.as_str()
7    }
8}
9
10impl From<String> for Utf8 {
11    #[inline]
12    fn from(value: String) -> Self {
13        Self(value.into())
14    }
15}
16
17impl From<&str> for Utf8 {
18    #[inline]
19    fn from(value: &str) -> Self {
20        Self(value.into())
21    }
22}
23
24impl From<Utf8> for String {
25    #[inline]
26    fn from(value: Utf8) -> Self {
27        value.as_str().to_owned()
28    }
29}
30
31impl AsRef<str> for Utf8 {
32    #[inline]
33    fn as_ref(&self) -> &str {
34        self.as_str()
35    }
36}
37
38impl std::borrow::Borrow<str> for Utf8 {
39    #[inline]
40    fn borrow(&self) -> &str {
41        self.as_str()
42    }
43}
44
45impl std::ops::Deref for Utf8 {
46    type Target = str;
47
48    #[inline]
49    fn deref(&self) -> &str {
50        self.as_str()
51    }
52}