Skip to content

Commit 3463ae0

Browse files
committed
add from support for owned references
1 parent 69c1acb commit 3463ae0

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/interned.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,12 @@ impl From<String> for Interned {
108108
}
109109
}
110110

111+
impl From<&String> for Interned {
112+
fn from(value: &String) -> Self {
113+
value.as_bytes().into()
114+
}
115+
}
116+
111117
impl From<&OsStr> for Interned {
112118
fn from(value: &OsStr) -> Self {
113119
value.as_encoded_bytes().into()
@@ -120,6 +126,12 @@ impl From<OsString> for Interned {
120126
}
121127
}
122128

129+
impl From<&OsString> for Interned {
130+
fn from(value: &OsString) -> Self {
131+
value.as_encoded_bytes().into()
132+
}
133+
}
134+
123135
impl From<&Path> for Interned {
124136
fn from(value: &Path) -> Self {
125137
value.as_os_str().into()
@@ -132,6 +144,12 @@ impl From<PathBuf> for Interned {
132144
}
133145
}
134146

147+
impl From<&PathBuf> for Interned {
148+
fn from(value: &PathBuf) -> Self {
149+
value.as_os_str().into()
150+
}
151+
}
152+
135153
impl Borrow<BorrowedInterned> for Interned {
136154
fn borrow(&self) -> &BorrowedInterned {
137155
self.deref()

0 commit comments

Comments
 (0)