pub struct RuneId {
pub block: u64,
pub tx: u32,
/* private fields */
}Fields§
§block: u64§tx: u32Implementations§
Source§impl RuneId
impl RuneId
pub const BTC: Self
pub fn new(block: u64, tx: u32) -> Self
Sourcepub fn to_bytes(&self) -> [u8; 12]
pub fn to_bytes(&self) -> [u8; 12]
Returns token bytes as a fixed-size array without heap allocation
Sourcepub fn get_sorted_rune_ids(
rune0: &RuneId,
rune1: &RuneId,
) -> ([u8; 12], [u8; 12])
pub fn get_sorted_rune_ids( rune0: &RuneId, rune1: &RuneId, ) -> ([u8; 12], [u8; 12])
Deterministically sort the two RuneIds and return their little-endian
byte representations.
This is the canonical way we ensure that the same pair of rune always
maps to the same PDA seeds, regardless of call-site ordering.
The function is const-friendly and completely stack-allocated so it can be
evaluated at compile-time in tests.
Trait Implementations§
Source§impl BorshDeserialize for RuneId
impl BorshDeserialize for RuneId
Source§fn deserialize(buf: &mut &[u8]) -> Result<Self>
fn deserialize(buf: &mut &[u8]) -> Result<Self>
Deserializes this instance from a given slice of bytes.
Updates the buffer to point at the remaining bytes.
fn deserialize_reader<R: Read>(reader: &mut R) -> Result<Self>
Source§fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_slice(v: &[u8]) -> Result<Self, Error>
Deserialize this instance from a slice of bytes.
fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>where
R: Read,
Source§impl BorshSerialize for RuneId
impl BorshSerialize for RuneId
Source§impl<'de> Deserialize<'de> for RuneId
impl<'de> Deserialize<'de> for RuneId
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Ord for RuneId
impl Ord for RuneId
Source§impl PartialEq<RuneId> for RuneAmount
impl PartialEq<RuneId> for RuneAmount
Source§impl PartialOrd for RuneId
impl PartialOrd for RuneId
impl Copy for RuneId
impl Eq for RuneId
impl Pod for RuneId
impl StructuralPartialEq for RuneId
Auto Trait Implementations§
impl Freeze for RuneId
impl RefUnwindSafe for RuneId
impl Send for RuneId
impl Sync for RuneId
impl Unpin for RuneId
impl UnwindSafe for RuneId
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
Source§type Bits = T
type Bits = T
Self must have the same layout as the specified Bits except for
the possible invalid bit patterns being checked during
is_valid_bit_pattern.Source§fn is_valid_bit_pattern(_bits: &T) -> bool
fn is_valid_bit_pattern(_bits: &T) -> bool
If this function returns true, then it must be valid to reinterpret
bits
as &Self.