zstrings_as_zstrs

Function zstrings_as_zstrs 

Source
pub fn zstrings_as_zstrs(zstrings: &[ZString]) -> &[ZStr<'_>]
Available on crate feature alloc only.
Expand description

Re-view a slice of ZString as a slice of ZStr

let zstrings =
  [ZString::try_from("hello").unwrap(), ZString::try_from("world").unwrap()];
let s: &[ZStr<'_>] = zstrings_as_zstrs(&zstrings);
let mut iter = s.iter();
assert!("hello".chars().eq(iter.next().unwrap().chars()));
assert!("world".chars().eq(iter.next().unwrap().chars()));