From c8bf2be40853272b39a29f202521b1e963afcc37 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Sat, 4 Feb 2023 11:21:42 +0100 Subject: [PATCH] wchar_ffi.rs: implement from_ffi() for more FFI strings --- fish-rust/src/wchar_ffi.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/fish-rust/src/wchar_ffi.rs b/fish-rust/src/wchar_ffi.rs index 4ec7582cc..32b75df67 100644 --- a/fish-rust/src/wchar_ffi.rs +++ b/fish-rust/src/wchar_ffi.rs @@ -127,8 +127,20 @@ pub trait WCharFromFFI { fn from_ffi(&self) -> Target; } +impl WCharFromFFI for cxx::CxxWString { + fn from_ffi(&self) -> WString { + WString::from_chars(self.as_chars()) + } +} + impl WCharFromFFI for cxx::UniquePtr { fn from_ffi(&self) -> WString { WString::from_chars(self.as_chars()) } } + +impl WCharFromFFI for cxx::SharedPtr { + fn from_ffi(&self) -> WString { + WString::from_chars(self.as_chars()) + } +}