[][src]Trait tinyvec_string::bytearray::ByteArray

pub unsafe trait ByteArray: Array<Item = u8> {
    pub const DEFAULT: Self;
}

An array type containing bytes.

Because tinyvec_string has unsafe and tinyvec doesn't, this trait is required for soundness. unsafe code can depend on an unsafe trait, and tinyvec::Array is not unsafe.

The provided implementations of ByteArray for various sizes of [u8; N] follow this trait's contract, and it shouldn't be necessary to add implementations for other types in most cases.

Implementations are provided for [u8; N] for N <= 32 and powers of 2 <= 4096. Other implementations could be provided on request.

Safety

Any types that implement this trait must have tinyvec::Array implementations that always return the same slices; i.e. between calls of as_slice or as_slice_mut, the implementation of the trait must not modify the contents of the slice (directly or indirectly) or return a slice with different contents. They must also always return slices with a length of CAPACITY.

Any implementations must also follow the stated contract of DEFAULT.

Any implementations that do not follow the above may cause memory safety errors within ArrayString or TinyString.

Associated Constants

pub const DEFAULT: Self[src]

Default value of the array.

This MUST be an array with length CAPACITY with all zero elements.

Loading content...

Implementations on Foreign Types

impl ByteArray for [u8; 0][src]

impl ByteArray for [u8; 1][src]

impl ByteArray for [u8; 2][src]

impl ByteArray for [u8; 3][src]

impl ByteArray for [u8; 4][src]

impl ByteArray for [u8; 5][src]

impl ByteArray for [u8; 6][src]

impl ByteArray for [u8; 7][src]

impl ByteArray for [u8; 8][src]

impl ByteArray for [u8; 9][src]

impl ByteArray for [u8; 10][src]

impl ByteArray for [u8; 11][src]

impl ByteArray for [u8; 12][src]

impl ByteArray for [u8; 13][src]

impl ByteArray for [u8; 14][src]

impl ByteArray for [u8; 15][src]

impl ByteArray for [u8; 16][src]

impl ByteArray for [u8; 17][src]

impl ByteArray for [u8; 18][src]

impl ByteArray for [u8; 19][src]

impl ByteArray for [u8; 20][src]

impl ByteArray for [u8; 21][src]

impl ByteArray for [u8; 22][src]

impl ByteArray for [u8; 23][src]

impl ByteArray for [u8; 24][src]

impl ByteArray for [u8; 25][src]

impl ByteArray for [u8; 26][src]

impl ByteArray for [u8; 27][src]

impl ByteArray for [u8; 28][src]

impl ByteArray for [u8; 29][src]

impl ByteArray for [u8; 30][src]

impl ByteArray for [u8; 31][src]

impl ByteArray for [u8; 32][src]

impl ByteArray for [u8; 64][src]

impl ByteArray for [u8; 128][src]

impl ByteArray for [u8; 256][src]

impl ByteArray for [u8; 512][src]

impl ByteArray for [u8; 1024][src]

impl ByteArray for [u8; 2048][src]

impl ByteArray for [u8; 4096][src]

Loading content...

Implementors

Loading content...