Skip to main content

FixedArray

Trait FixedArray 

Source
pub trait FixedArray<const LIMBS: usize> {
    // Required methods
    fn to_fixed_array(&self) -> [u8; LIMBS];
    fn from_fixed_array(array: &[u8; LIMBS]) -> Self;
}
Expand description

A trait for converting a type to and from a fixed-size array.

Required Methods§

Source

fn to_fixed_array(&self) -> [u8; LIMBS]

Convert the type to a fixed-size array.

Source

fn from_fixed_array(array: &[u8; LIMBS]) -> Self

Convert from a fixed-size array to the type.

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 FixedArray<1> for i8

Source§

fn to_fixed_array(&self) -> [u8; 1]

Source§

fn from_fixed_array(array: &[u8; 1]) -> Self

Source§

impl FixedArray<1> for u8

Source§

fn to_fixed_array(&self) -> [u8; 1]

Source§

fn from_fixed_array(array: &[u8; 1]) -> Self

Source§

impl FixedArray<2> for i16

Source§

fn to_fixed_array(&self) -> [u8; 2]

Source§

fn from_fixed_array(array: &[u8; 2]) -> Self

Source§

impl FixedArray<2> for u16

Source§

fn to_fixed_array(&self) -> [u8; 2]

Source§

fn from_fixed_array(array: &[u8; 2]) -> Self

Source§

impl FixedArray<4> for i32

Source§

fn to_fixed_array(&self) -> [u8; 4]

Source§

fn from_fixed_array(array: &[u8; 4]) -> Self

Source§

impl FixedArray<4> for u32

Source§

fn to_fixed_array(&self) -> [u8; 4]

Source§

fn from_fixed_array(array: &[u8; 4]) -> Self

Source§

impl FixedArray<8> for i64

Source§

fn to_fixed_array(&self) -> [u8; 8]

Source§

fn from_fixed_array(array: &[u8; 8]) -> Self

Source§

impl FixedArray<8> for u64

Source§

fn to_fixed_array(&self) -> [u8; 8]

Source§

fn from_fixed_array(array: &[u8; 8]) -> Self

Source§

impl FixedArray<16> for i128

Source§

fn to_fixed_array(&self) -> [u8; 16]

Source§

fn from_fixed_array(array: &[u8; 16]) -> Self

Source§

impl FixedArray<16> for u128

Source§

fn to_fixed_array(&self) -> [u8; 16]

Source§

fn from_fixed_array(array: &[u8; 16]) -> Self

Source§

impl FixedArray<ISIZE_BYTES> for isize

Source§

fn to_fixed_array(&self) -> [u8; 8]

Source§

fn from_fixed_array(array: &[u8; 8]) -> Self

Source§

impl FixedArray<USIZE_BYTES> for usize

Source§

fn to_fixed_array(&self) -> [u8; 8]

Source§

fn from_fixed_array(array: &[u8; 8]) -> Self

Implementors§