pub struct RuneId {
pub block: u64,
pub tx: u32,
/* private fields */
}Fields§
§block: u64§tx: u32Implementations§
Source§impl RuneId
impl RuneId
pub const BTC: RuneId
pub fn new(block: u64, tx: u32) -> RuneId
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
Available on crate feature borsh only.
impl BorshDeserialize for RuneId
Available on crate feature
borsh only.Source§fn deserialize(buf: &mut &[u8]) -> Result<RuneId, Error>
fn deserialize(buf: &mut &[u8]) -> Result<RuneId, Error>
Deserializes this instance from a given slice of bytes.
Updates the buffer to point at the remaining bytes.
fn deserialize_reader<R>(reader: &mut R) -> Result<RuneId, Error>where
R: Read,
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
Available on crate feature borsh only.
impl BorshSerialize for RuneId
Available on crate feature
borsh only.Source§impl<'de> Deserialize<'de> for RuneId
Available on crate feature serde only.
impl<'de> Deserialize<'de> for RuneId
Available on crate feature
serde only.Source§fn deserialize<D>(
deserializer: D,
) -> Result<RuneId, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<RuneId, <D as Deserializer<'de>>::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
Source§impl Serialize for RuneId
Available on crate feature serde only.
impl Serialize for RuneId
Available on crate feature
serde only.Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
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.Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.