Skip to main content

NewByteArray

Trait NewByteArray 

Source
pub trait NewByteArray<const LENGTH: usize>: MutByteArray<LENGTH> + NewBytes {
    // Required methods
    fn new_byte_array() -> Self;
    fn gen() -> Self;

    // Provided method
    fn generate() -> Self
       where Self: Sized { ... }
}
Expand description

Fixed-length byte array that can be created and initialized.

Required Methods§

Source

fn new_byte_array() -> Self

Returns a new fixed-length byte array, initialized with zeroes.

Source

fn gen() -> Self

👎Deprecated:

use generate() instead

Returns a new fixed-length byte array, filled with random values.

Prefer generate. gen is retained for compatibility with older Rust editions.

Provided Methods§

Source

fn generate() -> Self
where Self: Sized,

Returns a new fixed-length byte array, filled with random values.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<const LENGTH: usize> NewByteArray<LENGTH> for Vec<u8>

Source§

fn gen() -> Self

👎Deprecated:

use generate() instead

Returns a new byte array filled with random data.

Source§

fn new_byte_array() -> Self

Source§

impl<const LENGTH: usize> NewByteArray<LENGTH> for [u8; LENGTH]

Source§

fn gen() -> Self

👎Deprecated:

use generate() instead

Returns a new byte array filled with random data.

Source§

fn new_byte_array() -> Self

Implementors§

Source§

impl<const LENGTH: usize> NewByteArray<LENGTH> for HeapByteArray<LENGTH>

Available on crate feature protected only.
Source§

impl<const LENGTH: usize> NewByteArray<LENGTH> for Protected<HeapByteArray<LENGTH>, ReadWrite, Locked>

Available on crate feature protected only.
Source§

impl<const LENGTH: usize> NewByteArray<LENGTH> for StackByteArray<LENGTH>