Trait method lrs::string::ToCStr::to_or_as_mut_cstr

Tries to create a mutable CStr without copying and copies if that's not possible.

Syntax

fn to_or_as_mut_cstr(&'a mut self, buf: &'a mut [u8]) -> Result<&'a mut CStr, Errno>

Arguments

NameDescription
buf

The buffer in which the CStr will be created if it has to be copied.

Return value

Returns the borrowed or created CStr.

Remarks

The default implementation simply calls to_cstr.