Skip to main content

cpp_text_view

Function cpp_text_view 

Source
pub const unsafe fn cpp_text_view<'text>(
    text: *const c_char,
    length: usize,
) -> Result<&'text str, Utf8Error>
Expand description

Borrows the UTF-8 text of a C++ string llama.cpp exposes as a pointer and a length.

§Safety

text must point to length readable bytes that stay alive and unchanged for 'text.

§Errors

Returns Utf8Error when the bytes are not UTF-8.