Struct const_base::ArrayStr

source ·
#[repr(transparent)]
pub struct ArrayStr<const N: usize> { /* private fields */ }
Expand description

A utf-8 byte array

Example

use const_base::ArrayStr;

static ARR_STR: ArrayStr<12> = ArrayStr::from_utf8_unwrap(*b"hello world!");

assert_eq!(ARR_STR.as_str(), "hello world!");
assert_eq!(ARR_STR, "hello world!");

Implementations§

Constructs an ArrayStr, returning an error if arr isn’t valid utf-8.

Constructs an ArrayStr

Panics

Panics if arr isn’t valid utf-8.

Constructs an ArrayStr

Safety

arr must be valid utf-8.

Gets a reference to the wrapped byte array.

Gets a slice of the wrapped byte array.

Unwraps this into the wrapped byte array.

Gets the length of this array string.

Gets a string slice of the entire array string.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Formats the value using the given formatter. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

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.