Trait method lrs::string::ToCString::rmo_cstr

Tries to convert the object into an Rmo<CStr> with or without allocating.

Syntax

fn rmo_cstr<H>(&'a self, _buf: &'a mut [u8]) -> Result<Rmo<'a, CStr, H>, Errno>
   where H: Allocator,
         <H as Allocator>::Pool: Default,

Arguments

NameDescription
_buf

Scratch space.

Remarks

The general strategy is as follows: If the object can be interpreted as a CStr, a borrowed Rmo is returned. If it can be interpreted as a CStr by copying it into the provided buffer, it's copied and returned as a borrowed Rmo. Otherwise, a CString is allocated.

The default implementation simply calls to_cstring.