let delta = self.1 - self.0; let n = u128::from(base) | u128::from(delta) << 51; n.to_le_bytes()[0..11].try_into().unwrap() } } pub(super) type TxidValue = [u8; 32]; impl Entry for Txid { type Value = TxidValue; fn load(value: Self::Value) -> Self { Txid::from_byte_array(value) } fn store(self) -> Self::Value { Txid::to_byte_array(self) } } #[cfg(test)] mod tests { use super::*; #[test] fn inscription_id_entry() { let inscription_id = "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdefi0" .parse::() .unwrap(); assert_eq!( inscription_id.store(), ( 0x0123456789abcdef0123456789abcdef, 0x0123456789abcdef0123456789abcdef, 0 ) ); assert_eq!( InscriptionId::load(( 0x0123456789abcdef0123456789abcdef, 0x0123456789abcdef0123456789abcdef, 0 )), inscription_id ); } #[test] fn parent_entry_index() { let inscription_id = "0000000000000000000000000000000000000000000000000000000000000000i1"