#c-strings #utf-16 #traits #universal

univstring

The Universal String(Rust String, CString, Wide(UTF-16/UTF-32) CString) trait

2 unstable releases

0.4.3 Oct 23, 2020
0.2.2 Feb 27, 2018

#1364 in Text processing

Custom license

14KB
150 lines

The Universal String trait | Documentation

// more optimal way to take some cstrings as argument
fn take_wstr<S: UnivString + ?Sized>(s: &S)
{
  let _ws = s.to_wcstr().unwrap();
  // do something with the WideCString...
}
// call the function
take_wstr("test");
let existing_cstr = CString::new("...").unwrap();
take_wstr(&existing_cstr);

Dependencies

~520KB