Skip to content

Commit

Permalink
Merge pull request #52 from sosthene-nitrokey/byte-array-const
Browse files Browse the repository at this point in the history
Make ByteArray::new and ByteArray::into_array const
  • Loading branch information
dtolnay authored Jun 25, 2024
2 parents dde7c9e + ed0c0be commit 542f86d
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 542f86d

Please sign in to comment.