Skip to content

Commit

Permalink
Make ByteArray::new and ByteArray::into_array const
Browse files Browse the repository at this point in the history
  • Loading branch information
sosthene-nitrokey committed Jun 20, 2024
1 parent 1dd071d commit ed0c0be
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/bytearray.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ pub struct ByteArray<const N: usize> {

impl<const N: usize> ByteArray<N> {
/// Wrap an existing [array] into a `ByteArray`.
pub fn new(bytes: [u8; N]) -> Self {
pub const fn new(bytes: [u8; N]) -> Self {
ByteArray { bytes }
}

/// Unwrap the byte array underlying this `ByteArray`.
pub fn into_array(self) -> [u8; N] {
pub const fn into_array(self) -> [u8; N] {
self.bytes
}

Expand Down

0 comments on commit ed0c0be

Please sign in to comment.