From eba638ec9ba8db45839658ba807a3d7299bde180 Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Sat, 8 Aug 2020 03:32:56 +0900 Subject: [PATCH] impl &String for PyString --- vm/src/obj/objstr.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/vm/src/obj/objstr.rs b/vm/src/obj/objstr.rs index 092c1bf6d..7240e6ef2 100644 --- a/vm/src/obj/objstr.rs +++ b/vm/src/obj/objstr.rs @@ -64,9 +64,12 @@ impl AsRef for PyString { } } -impl From<&str> for PyString { - fn from(s: &str) -> PyString { - s.to_owned().into() +impl From<&T> for PyString +where + T: AsRef + ?Sized, +{ + fn from(s: &T) -> PyString { + s.as_ref().to_owned().into() } }