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 slice of the UTF-8 code bytes of the string.

Return a mutable slice of the UTF-8 code bytes of the string.

Return a pointer to the start of the string.

Return a mutable pointer to the start of the string.

Iterate over the characters of the string.

Iterate over the characters of the string and their byte positions.

Return whether the given byte position is a character boundary.

Trait Implementations

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

The returned type after indexing.

Performs the indexing (container[index]) operation. Read more

Performs the mutable indexing (container[index]) operation. Read more

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more