mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-05-07 04:39:10 -07:00
computer: convert stores to vecs part 1
This commit is contained in:
95
crates/brk_core/src/structs/anyaddressdataindex.rs
Normal file
95
crates/brk_core/src/structs/anyaddressdataindex.rs
Normal file
@@ -0,0 +1,95 @@
|
||||
use std::ops::Add;
|
||||
|
||||
use byteview::ByteView;
|
||||
use derive_deref::{Deref, DerefMut};
|
||||
use serde::Serialize;
|
||||
use zerocopy::{FromBytes, IntoBytes};
|
||||
use zerocopy_derive::{FromBytes, Immutable, IntoBytes, KnownLayout};
|
||||
|
||||
use crate::{CheckedSub, Printable, TypeIndex};
|
||||
|
||||
#[derive(
|
||||
Debug,
|
||||
PartialEq,
|
||||
Eq,
|
||||
PartialOrd,
|
||||
Ord,
|
||||
Clone,
|
||||
Copy,
|
||||
Deref,
|
||||
DerefMut,
|
||||
Default,
|
||||
FromBytes,
|
||||
Immutable,
|
||||
IntoBytes,
|
||||
KnownLayout,
|
||||
Serialize,
|
||||
)]
|
||||
pub struct AnyAddressDataIndex(TypeIndex);
|
||||
// impl From<TypeIndex> for AddressDataIndex {
|
||||
// fn from(value: TypeIndex) -> Self {
|
||||
// Self(value)
|
||||
// }
|
||||
// }
|
||||
// impl From<AddressDataIndex> for TypeIndex {
|
||||
// fn from(value: AddressDataIndex) -> Self {
|
||||
// value.0
|
||||
// }
|
||||
// }
|
||||
// impl From<AddressDataIndex> for u32 {
|
||||
// fn from(value: AddressDataIndex) -> Self {
|
||||
// Self::from(*value)
|
||||
// }
|
||||
// }
|
||||
// impl From<u32> for AddressDataIndex {
|
||||
// fn from(value: u32) -> Self {
|
||||
// Self(TypeIndex::from(value))
|
||||
// }
|
||||
// }
|
||||
// impl From<AddressDataIndex> for usize {
|
||||
// fn from(value: AddressDataIndex) -> Self {
|
||||
// Self::from(*value)
|
||||
// }
|
||||
// }
|
||||
// impl From<usize> for AddressDataIndex {
|
||||
// fn from(value: usize) -> Self {
|
||||
// Self(TypeIndex::from(value))
|
||||
// }
|
||||
// }
|
||||
// impl Add<usize> for AddressDataIndex {
|
||||
// type Output = Self;
|
||||
// fn add(self, rhs: usize) -> Self::Output {
|
||||
// Self(*self + rhs)
|
||||
// }
|
||||
// }
|
||||
// impl CheckedSub<AddressDataIndex> for AddressDataIndex {
|
||||
// fn checked_sub(self, rhs: Self) -> Option<Self> {
|
||||
// self.0.checked_sub(rhs.0).map(Self)
|
||||
// }
|
||||
// }
|
||||
|
||||
// impl Printable for AddressDataIndex {
|
||||
// fn to_string() -> &'static str {
|
||||
// "p2pk33addressindex"
|
||||
// }
|
||||
|
||||
// fn to_possible_strings() -> &'static [&'static str] {
|
||||
// &["addr", "p2pk33addr", "p2pk33addressindex"]
|
||||
// }
|
||||
// }
|
||||
|
||||
// impl From<ByteView> for AddressDataIndex {
|
||||
// fn from(value: ByteView) -> Self {
|
||||
// Self::read_from_bytes(&value).unwrap()
|
||||
// }
|
||||
// }
|
||||
// impl From<AddressDataIndex> for ByteView {
|
||||
// fn from(value: AddressDataIndex) -> Self {
|
||||
// Self::from(&value)
|
||||
// }
|
||||
// }
|
||||
// impl From<&AddressDataIndex> for ByteView {
|
||||
// fn from(value: &AddressDataIndex) -> Self {
|
||||
// Self::new(value.as_bytes())
|
||||
// }
|
||||
// }
|
||||
@@ -1,6 +1,7 @@
|
||||
mod addressbytes;
|
||||
mod addressbyteshash;
|
||||
mod addressdata;
|
||||
mod anyaddressdataindex;
|
||||
mod bitcoin;
|
||||
mod blockhash;
|
||||
mod blockhashprefix;
|
||||
@@ -59,6 +60,7 @@ mod yearindex;
|
||||
pub use addressbytes::*;
|
||||
pub use addressbyteshash::*;
|
||||
pub use addressdata::*;
|
||||
pub use anyaddressdataindex::*;
|
||||
pub use bitcoin::*;
|
||||
pub use blockhash::*;
|
||||
pub use blockhashprefix::*;
|
||||
|
||||
Reference in New Issue
Block a user