Struct null_terminated::NulStr [−][src]
#[repr(transparent)]pub struct NulStr(_);
Expand description
Null-terminated UTF-8 encoded string
&NulStr
is a thin pointer, so it can be readily used with FFI.
One can convert from &Nul<u8>
to &NulStr
with try_from
, which checks whether its
argument is valid UTF-8.
Implementations
Create a reference to a null-terminated string, given a pointer to its start.
The caller must make sure the argument does, in fact, point to a null-terminated string; the string is valid UTF-8; and the returned reference not live longer than the array it refers to. These requirements are not checked.
Create a mutable reference to a null-terminated string, given a pointer to its start.
The caller must make sure the argument does, in fact, point to a null-terminated string; the string is valid UTF-8; and the returned reference not live longer than the array it refers to. These requirements are not checked.
Return a mutable slice of the UTF-8 code bytes of the string.
Return a mutable pointer to the start of the string.
Iterate over the characters of the string.
pub fn char_indices(&self) -> CharIndices<'_>ⓘNotable traits for CharIndices<'a>impl<'a> Iterator for CharIndices<'a> type Item = (usize, char);
pub fn char_indices(&self) -> CharIndices<'_>ⓘNotable traits for CharIndices<'a>impl<'a> Iterator for CharIndices<'a> type Item = (usize, char);
impl<'a> Iterator for CharIndices<'a> type Item = (usize, char);
Iterate over the characters of the string and their byte positions.
Return whether the given byte position is a character boundary.
Trait Implementations
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more