cf-rust-api 0.0.1

could filter sdk for rust
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use windows::core::{self, HSTRING};

// TODO: add something to convert an Option<T> to a *const T and *mut T

pub trait ToHString
where
    Self: AsRef<[u16]>,
{
    /// Converts a 16-bit buffer to a Windows reference-counted [HSTRING][windows::core::HSTRING].
    fn to_hstring(&self) -> core::Result<HSTRING> {
        Ok(HSTRING::from_wide(self.as_ref()))
    }
}

impl<T: AsRef<[u16]>> ToHString for T {}