mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-29 11:14:38 +08:00
impl &String for PyString
This commit is contained in:
1 parent
7b6ab8da72
commit
eba638ec9b
1 file changed
+6
-3
@@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user