pub struct Txid(/* private fields */);
Expand description
A bitcoin transaction hash/transaction ID.
For compatibility with the existing Bitcoin infrastructure and historical
and current versions of the Bitcoin Core software itself, this and
other sha256d::Hash
types, are serialized in reverse
byte order when converted to a hex string via std::fmt::Display
trait operations.
See hashes::Hash::DISPLAY_BACKWARD
for more details.
Implementations§
§impl Txid
impl Txid
pub fn from_raw_hash(inner: Hash) -> Txid
pub fn from_raw_hash(inner: Hash) -> Txid
Creates this wrapper type from the inner hash type.
pub fn to_raw_hash(self) -> Hash
pub fn to_raw_hash(self) -> Hash
Returns the inner hash (sha256, sh256d etc.).
pub fn as_raw_hash(&self) -> &Hash
pub fn as_raw_hash(&self) -> &Hash
Returns a reference to the inner hash (sha256, sh256d etc.).
Trait Implementations§
§impl<'de> Deserialize<'de> for Txid
impl<'de> Deserialize<'de> for Txid
§fn deserialize<D>(d: D) -> Result<Txid, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(d: D) -> Result<Txid, <D as Deserializer<'de>>::Error>where D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
§impl From<&Transaction> for Txid
impl From<&Transaction> for Txid
§fn from(tx: &Transaction) -> Txid
fn from(tx: &Transaction) -> Txid
Converts to this type from the input type.
§impl From<Transaction> for Txid
impl From<Transaction> for Txid
§fn from(tx: Transaction) -> Txid
fn from(tx: Transaction) -> Txid
Converts to this type from the input type.
§impl Hash for Txid
impl Hash for Txid
§type Engine = <Hash as Hash>::Engine
type Engine = <Hash as Hash>::Engine
A hashing engine which bytes can be serialized into. It is expected
to implement the
io::Write
trait, and to never return errors under
any conditions.§const DISPLAY_BACKWARD: bool = true
const DISPLAY_BACKWARD: bool = true
Flag indicating whether user-visible serializations of this hash
should be backward. For some reason Satoshi decided this should be
true for
Sha256dHash
, so here we are.§fn from_engine(e: <Txid as Hash>::Engine) -> Txid
fn from_engine(e: <Txid as Hash>::Engine) -> Txid
Produces a hash from the current state of a given engine.
§fn from_byte_array(bytes: <Txid as Hash>::Bytes) -> Txid
fn from_byte_array(bytes: <Txid as Hash>::Bytes) -> Txid
Constructs a hash from the underlying byte array.
§fn to_byte_array(self) -> <Txid as Hash>::Bytes
fn to_byte_array(self) -> <Txid as Hash>::Bytes
Returns the underlying byte array.
§fn as_byte_array(&self) -> &<Txid as Hash>::Bytes
fn as_byte_array(&self) -> &<Txid as Hash>::Bytes
Returns a reference to the underlying byte array.
§impl<I> Index<I> for Txidwhere
I: SliceIndex<[u8]>,
impl<I> Index<I> for Txidwhere I: SliceIndex<[u8]>,
§impl Ord for Txid
impl Ord for Txid
§impl PartialOrd<Txid> for Txid
impl PartialOrd<Txid> for Txid
§fn partial_cmp(&self, other: &Txid) -> Option<Ordering>
fn partial_cmp(&self, other: &Txid) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read more§impl SerdeHash for Txid
impl SerdeHash for Txid
§fn from_slice_delegated(sl: &[u8]) -> Result<Txid, Error>
fn from_slice_delegated(sl: &[u8]) -> Result<Txid, Error>
Helper function to turn a deserialized slice into the correct hash type.
§fn serialize<S>(
&self,
s: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>( &self, s: S ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where S: Serializer,
Do serde serialization.
§fn deserialize<'de, D>(d: D) -> Result<Self, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<'de, D>(d: D) -> Result<Self, <D as Deserializer<'de>>::Error>where D: Deserializer<'de>,
Do serde deserialization.
§impl Serialize for Txid
impl Serialize for Txid
§fn serialize<S>(
&self,
s: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>( &self, s: 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 Txid
impl Eq for Txid
impl StructuralEq for Txid
impl StructuralPartialEq for Txid
Auto Trait Implementations§
impl RefUnwindSafe for Txid
impl Send for Txid
impl Sync for Txid
impl Unpin for Txid
impl UnwindSafe for Txid
Blanket Implementations§
§impl<T> Base32Len for Twhere
T: AsRef<[u8]>,
impl<T> Base32Len for Twhere T: AsRef<[u8]>,
§fn base32_len(&self) -> usize
fn base32_len(&self) -> usize
Calculate the base32 serialized length
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<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
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> ⓘ
§impl<T> ToBase32 for Twhere
T: AsRef<[u8]>,
impl<T> ToBase32 for Twhere T: AsRef<[u8]>,
§fn write_base32<W>(&self, writer: &mut W) -> Result<(), <W as WriteBase32>::Err>where
W: WriteBase32,
fn write_base32<W>(&self, writer: &mut W) -> Result<(), <W as WriteBase32>::Err>where W: WriteBase32,
Encode as base32 and write it to the supplied writer
Implementations shouldn’t allocate.