From f5343076ab1cee2087fb24f96b96cdb5a4092dc5 Mon Sep 17 00:00:00 2001 From: Justus Winter Date: Thu, 6 Jul 2023 12:31:00 +0200 Subject: ipc: Add additional constructors. --- ipc/src/sexp.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ipc/src/sexp.rs b/ipc/src/sexp.rs index 7a8ce18c..69c9e151 100644 --- a/ipc/src/sexp.rs +++ b/ipc/src/sexp.rs @@ -414,12 +414,24 @@ impl Drop for String_ { } } +impl From for String_ { + fn from(b: std::string::String) -> Self { + Self::new(b.into_bytes()) + } +} + impl From<&str> for String_ { fn from(b: &str) -> Self { Self::new(b.as_bytes().to_vec()) } } +impl From> for String_ { + fn from(b: Vec) -> Self { + Self::new(b.into_boxed_slice()) + } +} + impl From<&[u8]> for String_ { fn from(b: &[u8]) -> Self { Self::new(b.to_vec()) -- cgit v1.2.3