pub struct CppAllocatedString { /* private fields */ }Expand description
A string the C++ wrappers allocated and handed over through an out-parameter, freed with
llama_rs_string_free when dropped.
Implementations§
Source§impl CppAllocatedString
impl CppAllocatedString
Sourcepub const unsafe fn from_raw(pointer: *mut c_char) -> Self
pub const unsafe fn from_raw(pointer: *mut c_char) -> Self
§Safety
pointer must be a non-null, NUL-terminated string allocated by llama_rs_dup_string
that nothing else frees.
Sourcepub fn into_reported_error<TError>(
self,
operation: &'static str,
reported: impl FnOnce(String) -> TError,
) -> TErrorwhere
TError: ExceptionMessageError,
pub fn into_reported_error<TError>(
self,
operation: &'static str,
reported: impl FnOnce(String) -> TError,
) -> TErrorwhere
TError: ExceptionMessageError,
Reads this string as the message of a C++ exception the operation reported, building
the error reported makes of it, or the error type’s own error for a message that is not
valid UTF-8.
Sourcepub fn into_string(self) -> Result<String, FromUtf8Error>
pub fn into_string(self) -> Result<String, FromUtf8Error>
§Errors
Returns FromUtf8Error, keeping the bytes, when the string is not valid UTF-8.
Trait Implementations§
Source§impl Debug for CppAllocatedString
impl Debug for CppAllocatedString
Source§impl Drop for CppAllocatedString
impl Drop for CppAllocatedString
Auto Trait Implementations§
impl !Send for CppAllocatedString
impl !Sync for CppAllocatedString
impl Forget for CppAllocatedString
impl Freeze for CppAllocatedString
impl Move for CppAllocatedString
impl RefUnwindSafe for CppAllocatedString
impl Unpin for CppAllocatedString
impl UnsafeUnpin for CppAllocatedString
impl UnwindSafe for CppAllocatedString
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more