From c69c00e1e91e00d1496a310c09423d0e9a22af2c Mon Sep 17 00:00:00 2001 From: Soispha Date: Wed, 27 Mar 2024 22:15:59 +0100 Subject: [PATCH] feat(types/try_from_impl): Add a trixy::String from &str impl This makes it more convenient to use the api. --- src/types/traits/try_from_impl.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/types/traits/try_from_impl.rs b/src/types/traits/try_from_impl.rs index cc4dd9c..5dce092 100644 --- a/src/types/traits/try_from_impl.rs +++ b/src/types/traits/try_from_impl.rs @@ -33,6 +33,12 @@ impl From for String { String(c_char) } } +/// Plainly here for convenience +impl From<&str> for String { + fn from(value: &str) -> Self { + value.to_owned().into() + } +} impl TryFrom for std::string::String { type Error = crate::types::error::TypeConversionError;