Skip to content

Commit

Permalink
Implement Deref for Atom (#466)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rigidity authored Sep 16, 2024
1 parent 6daaefb commit 3291a32
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/allocator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use crate::reduction::EvalErr;
use chia_bls::{G1Element, G2Element};
use std::hash::Hash;
use std::hash::Hasher;
use std::ops::Deref;

const MAX_NUM_ATOMS: usize = 62500000;
const MAX_NUM_PAIRS: usize = 62500000;
Expand Down Expand Up @@ -130,6 +131,14 @@ impl<'a> AsRef<[u8]> for Atom<'a> {
}
}

impl<'a> Deref for Atom<'a> {
type Target = [u8];

fn deref(&self) -> &Self::Target {
self.as_ref()
}
}

impl<'a> Borrow<[u8]> for Atom<'a> {
fn borrow(&self) -> &[u8] {
self.as_ref()
Expand Down

0 comments on commit 3291a32

Please sign in to comment.