Skip to content

Commit 542f86d

Browse files
authored
Merge pull request #52 from sosthene-nitrokey/byte-array-const
Make ByteArray::new and ByteArray::into_array const
2 parents dde7c9e + ed0c0be commit 542f86d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/bytearray.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ pub struct ByteArray<const N: usize> {
4242

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

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

0 commit comments

Comments
 (0)