doc.rust-lang.org
fn consume(&mut self, amount: usize)
Marks the given amount of additional bytes from the internal buffer as having been read. Subsequent calls to read only return bytes that have not been marked as read.
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub trait BufRead
A BufRead is a type of Reader which has an internal buffer, allowing it to perform extra ways of reading.
trait
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub macro format!
Creates a String using interpolation of runtime expressions.
macro
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn format(args: Arguments<'_>) -> string::String
Takes an Arguments struct and returns the resulting formatted string.
function
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub mod fmt
Utilities for formatting and printing Strings.
module
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn nul_position(&self) -> usize
Returns the position of the nul byte in the slice that caused CString::new to fail.
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn into_vec(self) -> Vec<u8>
Consumes this error, returning the underlying vector of bytes which generated the error in the first place.
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub struct NulError
An error indicating that an interior nul byte was found.
struct
alloc
Stable since 1.64.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn utf8_error(&self) -> Utf8Error
Access the underlying UTF-8 error that was the cause of this error.
method
alloc
Stable since 1.7.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn into_cstring(self) -> CString
Consumes this error, returning original CString which generated the error.
method
alloc
Stable since 1.7.0
Version 1.100.0-nightly
doc.rust-lang.org
pub struct IntoStringError
An error indicating invalid UTF-8 when converting a CString into a String.
struct
alloc
Stable since 1.64.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn into_bytes(self) -> Vec<u8>
Returns the bytes that were attempted to convert to a CString.
method
alloc
Stable since 1.58.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn as_bytes(&self) -> &[u8]
Returns a slice of u8s bytes that were attempted to convert to a CString.
method
alloc
Stable since 1.58.0
Version 1.100.0-nightly
doc.rust-lang.org
pub struct FromVecWithNulError
An error indicating that a nul byte was not in the expected position.
struct
alloc
Stable since 1.64.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn new<T>(t: T) -> Result<CString, NulError>
Creates a new C-compatible string from a container of bytes.
associated_function
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn into_string(self) -> Result<String, IntoStringError>
Converts the CString into a String if it contains valid UTF-8 data.
method
alloc
Stable since 1.7.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn into_raw(self) -> *mut c_char
Consumes the CString and transfers ownership of the string to a C caller.
method
alloc
Stable since 1.4.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn into_bytes_with_nul(self) -> Vec<u8>
Equivalent to CString::into_bytes() except that the returned vector includes the trailing nul terminator.
method
alloc
Stable since 1.7.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn into_bytes(self) -> Vec<u8>
Consumes the CString and returns the underlying byte buffer.
method
alloc
Stable since 1.7.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn into_boxed_c_str(self) -> Box<CStr>
Converts this CString into a boxed CStr.
method
alloc
Stable since 1.20.0
Version 1.100.0-nightly