[−][src]Struct null_terminated::NulStr
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.
Methods
impl NulStr
[src]
pub const unsafe fn new_unchecked(p: *const u8) -> &'static Self
[src]
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.
pub unsafe fn new_unchecked_mut(p: *mut u8) -> &'static mut Self
[src]
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.
pub fn as_bytes(&self) -> &Nul<u8>
[src]
Return a slice of the UTF-8 code bytes of the string.
pub fn as_bytes_mut(&mut self) -> &mut Nul<u8>
[src]
Return a mutable slice of the UTF-8 code bytes of the string.
pub fn as_ptr(&self) -> *const u8
[src]
Return a pointer to the start of the string.
pub fn as_mut_ptr(&mut self) -> *const u8
[src]
Return a mutable pointer to the start of the string.
ⓘImportant traits for Chars<'a>pub fn chars(&self) -> Chars
[src]
Iterate over the characters of the string.
ⓘImportant traits for CharIndices<'a>pub fn char_indices(&self) -> CharIndices
[src]
Iterate over the characters of the string and their byte positions.
pub fn is_char_boundary(&self, k: usize) -> bool
[src]
Return whether the given byte position is a character boundary.
Trait Implementations
impl Debug for NulStr
[src]
impl Display for NulStr
[src]
impl PartialEq<NulStr> for NulStr
[src]
impl Eq for NulStr
[src]
impl Ord for NulStr
[src]
fn cmp(&self, other: &NulStr) -> Ordering
[src]
fn max(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
1.21.0[src]
fn clamp(self, min: Self, max: Self) -> Self
[src]
impl PartialOrd<NulStr> for NulStr
[src]
fn partial_cmp(&self, other: &NulStr) -> Option<Ordering>
[src]
fn lt(&self, other: &NulStr) -> bool
[src]
fn le(&self, other: &NulStr) -> bool
[src]
fn gt(&self, other: &NulStr) -> bool
[src]
fn ge(&self, other: &NulStr) -> bool
[src]
impl Index<RangeFull> for NulStr
[src]
impl IndexMut<RangeFull> for NulStr
[src]
impl Hash for NulStr
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,