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§
Source§impl Txid
impl Txid
Sourcepub fn from_raw_hash(inner: Hash) -> Txid
pub fn from_raw_hash(inner: Hash) -> Txid
Creates this wrapper type from the inner hash type.
Sourcepub fn to_raw_hash(self) -> Hash
pub fn to_raw_hash(self) -> Hash
Returns the inner hash (sha256, sh256d etc.).
Sourcepub 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 Copy for Txid
Source§impl<'de> Deserialize<'de> for Txid
impl<'de> Deserialize<'de> for Txid
Source§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 Eq for Txid
Source§impl From<&Transaction> for Txid
impl From<&Transaction> for Txid
Source§fn from(tx: &Transaction) -> Txid
fn from(tx: &Transaction) -> Txid
Converts to this type from the input type.
Source§impl<'a, T, A> From<CanonicalTx<'a, T, A>> for Txid
impl<'a, T, A> From<CanonicalTx<'a, T, A>> for Txid
Source§fn from(tx: CanonicalTx<'a, T, A>) -> Txid
fn from(tx: CanonicalTx<'a, T, A>) -> Txid
Converts to this type from the input type.
Source§impl From<Transaction> for Txid
impl From<Transaction> for Txid
Source§fn from(tx: Transaction) -> Txid
fn from(tx: Transaction) -> Txid
Converts to this type from the input type.
Source§impl From<Txid> for TxMerkleNode
impl From<Txid> for TxMerkleNode
Source§fn from(txid: Txid) -> TxMerkleNode
fn from(txid: Txid) -> TxMerkleNode
Converts to this type from the input type.
Source§impl Hash for Txid
impl Hash for Txid
Source§const LEN: usize = <sha256d::Hash as ::bitcoin_hashes::Hash>::LEN
const LEN: usize = <sha256d::Hash as ::bitcoin_hashes::Hash>::LEN
Length of the hash, in bytes.
Source§const DISPLAY_BACKWARD: bool = <sha256d::Hash as ::bitcoin_hashes::Hash>::DISPLAY_BACKWARD
const DISPLAY_BACKWARD: bool = <sha256d::Hash as ::bitcoin_hashes::Hash>::DISPLAY_BACKWARD
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.Source§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.Source§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.
Source§fn from_slice(sl: &[u8]) -> Result<Txid, FromSliceError>
fn from_slice(sl: &[u8]) -> Result<Txid, FromSliceError>
Copies a byte slice into a hash object.
Source§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.
Source§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.
Source§fn hash_byte_chunks<B, I>(byte_slices: I) -> Self
fn hash_byte_chunks<B, I>(byte_slices: I) -> Self
Hashes all the byte slices retrieved from the iterator together.
Source§impl Ord for Txid
impl Ord for Txid
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for Txid
impl PartialOrd for Txid
Source§impl SealTxid for Txid
impl SealTxid for Txid
Source§impl SerdeHash for Txid
impl SerdeHash for Txid
Source§fn from_slice_delegated(sl: &[u8]) -> Result<Txid, FromSliceError>
fn from_slice_delegated(sl: &[u8]) -> Result<Txid, FromSliceError>
Helper function to turn a deserialized slice into the correct hash type.
Source§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.
Source§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.
Source§impl Serialize for Txid
impl Serialize for Txid
Source§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
Source§impl StrictDecode for Txid
impl StrictDecode for Txid
fn strict_decode(reader: &mut impl TypedRead) -> Result<Txid, DecodeError>
fn strict_read(reader: impl ReadRaw) -> Result<Self, DecodeError>
Source§impl StrictDeserialize for Txid
impl StrictDeserialize for Txid
fn from_strict_serialized<const MAX: usize>( ast_data: Confined<Vec<u8>, 0, MAX>, ) -> Result<Self, DeserializeError>
fn strict_deserialize_from_file<const MAX: usize>( path: impl AsRef<Path>, ) -> Result<Self, DeserializeError>
Source§impl StrictDumb for Txid
impl StrictDumb for Txid
fn strict_dumb() -> Txid
Source§impl StrictEncode for Txid
impl StrictEncode for Txid
fn strict_encode<W>(&self, writer: W) -> Result<W, Error>where
W: TypedWrite,
fn strict_write(&self, writer: impl WriteRaw) -> Result<(), Error>
impl StrictProduct for Txid
Source§impl StrictSerialize for Txid
impl StrictSerialize for Txid
fn strict_serialized_len<const MAX: usize>(&self) -> Result<usize, Error>
fn to_strict_serialized<const MAX: usize>( &self, ) -> Result<Confined<Vec<u8>, 0, MAX>, SerializeError>
fn strict_serialize_to_file<const MAX: usize>( &self, path: impl AsRef<Path>, ) -> Result<(), SerializeError>
Source§impl StrictTuple for Txid
impl StrictTuple for Txid
const FIELD_COUNT: u8 = 1
fn strict_check_fields()
fn strict_type_info() -> TypeInfo<Self>
Source§impl StrictType for Txid
impl StrictType for Txid
const STRICT_LIB_NAME: &'static str = LIB_NAME_BITCOIN
fn strict_name() -> Option<TypeName>
impl StructuralPartialEq for Txid
Auto Trait Implementations§
impl Freeze for Txid
impl RefUnwindSafe for Txid
impl Send for Txid
impl Sync for Txid
impl Unpin for Txid
impl UnsafeUnpin for Txid
impl UnwindSafe for Txid
Blanket Implementations§
Source§impl<T> Base32Len for T
impl<T> Base32Len for T
Source§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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CheckBase32<Vec<u5>> for T
impl<T> CheckBase32<Vec<u5>> for T
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
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> ToBase32 for T
impl<T> ToBase32 for T
Source§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.
Source§impl<T> ToHex for T
impl<T> ToHex for T
Source§fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
Encode the hex strict representing
self into the result. Lower case
letters are used (e.g. f9b4ca)Source§fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
Encode the hex strict representing
self into the result. Upper case
letters are used (e.g. F9B4CA)