mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-04-25 07:09:59 -07:00
brk: first commit
This commit is contained in:
31
_src/structs/array.rs
Normal file
31
_src/structs/array.rs
Normal file
@@ -0,0 +1,31 @@
|
||||
use std::fmt::Debug;
|
||||
|
||||
use allocative::Allocative;
|
||||
use derive_deref::{Deref, DerefMut};
|
||||
use snkrj::{direct_repr, Storable, UnsizedStorable};
|
||||
|
||||
#[derive(
|
||||
Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Deref, DerefMut, Default, Copy, Allocative,
|
||||
)]
|
||||
pub struct U8x19([u8; 19]);
|
||||
direct_repr!(U8x19);
|
||||
impl From<&[u8]> for U8x19 {
|
||||
fn from(slice: &[u8]) -> Self {
|
||||
let mut arr = Self::default();
|
||||
arr.copy_from_slice(slice);
|
||||
arr
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(
|
||||
Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Deref, DerefMut, Default, Copy, Allocative,
|
||||
)]
|
||||
pub struct U8x31([u8; 31]);
|
||||
direct_repr!(U8x31);
|
||||
impl From<&[u8]> for U8x31 {
|
||||
fn from(slice: &[u8]) -> Self {
|
||||
let mut arr = Self::default();
|
||||
arr.copy_from_slice(slice);
|
||||
arr
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user