From b8a4536eacd49562f044c360c359481e78da5fcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Linus=20F=C3=A4rnstrand?= Date: Wed, 22 Nov 2017 14:57:31 +0100 Subject: [PATCH] Implement From<&str> for CFString --- core-foundation/src/string.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/core-foundation/src/string.rs b/core-foundation/src/string.rs index 0415ecd..5026b71 100644 --- a/core-foundation/src/string.rs +++ b/core-foundation/src/string.rs @@ -43,6 +43,13 @@ impl FromStr for CFString { } } +impl<'a> From<&'a str> for CFString { + #[inline] + fn from(string: &'a str) -> CFString { + CFString::new(string) + } +} + impl fmt::Display for CFString { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { unsafe {