Struct KanziStr
pub struct KanziStr(/* private fields */);Implementations§
§impl KanziStr
impl KanziStr
pub const fn from_slice(slice: &[i8]) -> &KanziStr
pub const fn from_bytes(bytes: &[u8]) -> &KanziStr
pub const fn from_utf8(utf8: &str) -> &KanziStr
pub unsafe fn from_string_view<'a>(ptr: *const u8, len: u64) -> &'a KanziStr
pub unsafe fn from_string_view<'a>(ptr: *const u8, len: u64) -> &'a KanziStr
§Safety
ptr and len must originate from a valid C++ std::string_view.
Unlike std::str::from_raw_parts, this function permits a null pointer to be passed in.
This accommodates the C++ behavior where an empty std::string_view may contain a nullptr,
whereas Rust requires all slices to have non-null pointers, even when empty.