pub struct Array<T, const LEN: usize>(/* private fields */);
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<const LEN: usize> BitAndAssign<Array<u8, LEN>> for Array<u8, LEN>
impl<const LEN: usize> BitAndAssign<Array<u8, LEN>> for Array<u8, LEN>
source§fn bitand_assign(&mut self, rhs: Self)
fn bitand_assign(&mut self, rhs: Self)
Performs the
&=
operation. Read moresource§impl<const LEN: usize> BitOrAssign<Array<u8, LEN>> for Array<u8, LEN>
impl<const LEN: usize> BitOrAssign<Array<u8, LEN>> for Array<u8, LEN>
source§fn bitor_assign(&mut self, rhs: Self)
fn bitor_assign(&mut self, rhs: Self)
Performs the
|=
operation. Read moresource§impl<const LEN: usize> BitXorAssign<Array<u8, LEN>> for Array<u8, LEN>
impl<const LEN: usize> BitXorAssign<Array<u8, LEN>> for Array<u8, LEN>
source§fn bitxor_assign(&mut self, rhs: Self)
fn bitxor_assign(&mut self, rhs: Self)
Performs the
^=
operation. Read moresource§impl<T, const LEN: usize> BorrowMut<[T]> for Array<T, LEN>
impl<T, const LEN: usize> BorrowMut<[T]> for Array<T, LEN>
source§fn borrow_mut(&mut self) -> &mut [T]
fn borrow_mut(&mut self) -> &mut [T]
Mutably borrows from an owned value. Read more
source§impl<T, const LEN: usize> IntoIterator for Array<T, LEN>
impl<T, const LEN: usize> IntoIterator for Array<T, LEN>
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
impl<T: Copy, const LEN: usize> Copy for Array<T, LEN>
impl<T: Eq, const LEN: usize> Eq for Array<T, LEN>
impl<T, const LEN: usize> StructuralEq for Array<T, LEN>
impl<T, const LEN: usize> StructuralPartialEq for Array<T, LEN>
Auto Trait Implementations§
impl<T, const LEN: usize> RefUnwindSafe for Array<T, LEN>where T: RefUnwindSafe,
impl<T, const LEN: usize> Send for Array<T, LEN>where T: Send,
impl<T, const LEN: usize> Sync for Array<T, LEN>where T: Sync,
impl<T, const LEN: usize> Unpin for Array<T, LEN>where T: Unpin,
impl<T, const LEN: usize> UnwindSafe for Array<T, LEN>where T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more