impl &String for PyString

This commit is contained in:
Jeong YunWon committed 2020-08-10 02:16:50 +09:00
1 parent 7b6ab8da72
commit eba638ec9b
1 file changed
+6 -3
+6 -3
View File
@@ -64,9 +64,12 @@ impl AsRef<str> for PyString {
}
}
impl From<&str> for PyString {
fn from(s: &str) -> PyString {
s.to_owned().into()
impl<T> From<&T> for PyString
where
T: AsRef<T> + ?Sized,
{
fn from(s: &T) -> PyString {
s.as_ref().to_owned().into()
}
}