added deref for blob

This commit is contained in:
Monica Moniot
2023-08-15 14:20:20 -04:00
parent 7c6a2fa5cf
commit 2eeb0aea9d
+15
View File
@@ -9,6 +9,8 @@
use std::array::TryFromSliceError;
use std::fmt::Debug;
use std::hash::Hash;
use std::ops::Deref;
use std::ops::DerefMut;
use serde::{Deserialize, Deserializer, Serialize, Serializer};
use zeroize::Zeroize;
@@ -34,6 +36,19 @@ impl<const L: usize> Blob<L> {
}
}
impl<const L: usize> DerefMut for Blob<L> {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}
impl<const L: usize> Deref for Blob<L> {
type Target = [u8; L];
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl<const L: usize> From<Blob<L>> for [u8; L] {
#[inline(always)]
fn from(value: Blob<L>) -> Self {