fix(bytecode): we need to be able to deconstruct Pointer
This commit is contained in:
parent
b77b3a14de
commit
6b6ed6e36a
1 changed files with 2 additions and 7 deletions
|
@ -18,8 +18,8 @@ impl Atom {
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
#[repr(align(16))]
|
#[repr(align(16))]
|
||||||
pub struct Pointer {
|
pub struct Pointer {
|
||||||
hmac: u64,
|
pub hmac: u64,
|
||||||
payload: u64,
|
pub payload: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Pointer> for Atom {
|
impl From<Pointer> for Atom {
|
||||||
|
@ -46,11 +46,6 @@ impl Pointer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline(always)]
|
|
||||||
pub fn hmac(&self) -> u64 {
|
|
||||||
self.hmac
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn verify(&self, key: &Atom) -> Option<u64> {
|
pub fn verify(&self, key: &Atom) -> Option<u64> {
|
||||||
if self.hmac == Self::calculate_hmac(self.payload, key) {
|
if self.hmac == Self::calculate_hmac(self.payload, key) {
|
||||||
|
|
Loading…
Reference in a new issue