pub struct Array<T, const LEN: usize>(_);
Expand description
Wrapper type for all fixed arrays implementing many important traits, so types based on it can simply derive their implementations.
Type keeps data in little-endian byte order and displays them in the same order (like bitcoin SHA256 single hash type).
Implementations§
source§impl<T, const LEN: usize> Array<T, LEN>
impl<T, const LEN: usize> Array<T, LEN>
sourcepub fn with_fill(val: T) -> Selfwhere
T: Copy,
pub fn with_fill(val: T) -> Selfwhere
T: Copy,
Constructs array filled with given value.
TODO: Revert commit 7110cee0cf539d8ff4270450183f7060a585bc87 and make
method const
once const_fn_trait_bound
stabilize
sourcepub const fn from_array(inner: [T; LEN]) -> Self
pub const fn from_array(inner: [T; LEN]) -> Self
Wraps inner representation into array type.
sourcepub fn as_slice_mut(&mut self) -> &mut [T] ⓘ
pub fn as_slice_mut(&mut self) -> &mut [T] ⓘ
Returns mutable byte slice representation.
Trait Implementations§
source§impl<T: Ord, const LEN: usize> Ord for Array<T, LEN>
impl<T: Ord, const LEN: usize> Ord for Array<T, LEN>
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl<T: PartialEq, const LEN: usize> PartialEq<Array<T, LEN>> for Array<T, LEN>
impl<T: PartialEq, const LEN: usize> PartialEq<Array<T, LEN>> for Array<T, LEN>
source§impl<T: PartialOrd, const LEN: usize> PartialOrd<Array<T, LEN>> for Array<T, LEN>
impl<T: PartialOrd, const LEN: usize> PartialOrd<Array<T, LEN>> for Array<T, LEN>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl<T, const LEN: usize> Wrapper for Array<T, LEN>
impl<T, const LEN: usize> Wrapper for Array<T, LEN>
source§impl<T, const LEN: usize> WrapperMut for Array<T, LEN>
impl<T, const LEN: usize> WrapperMut for Array<T, LEN>
source§fn as_inner_mut(&mut self) -> &mut Self::Inner
fn as_inner_mut(&mut self) -> &mut Self::Inner
Returns a mutable reference to the inner representation for the wrapper
type