Struct bdk_chain::DescriptorId
source · pub struct DescriptorId(pub Hash);
Expand description
Represents the unique ID of a descriptor.
This is useful for having a fixed-length unique representation of a descriptor, in particular, we use it to persist application state changes related to the descriptor without having to re-write the whole descriptor each time.
Tuple Fields§
§0: Hash
Implementations§
source§impl DescriptorId
impl DescriptorId
sourcepub fn from_raw_hash(inner: Hash) -> DescriptorId
pub fn from_raw_hash(inner: Hash) -> DescriptorId
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§
source§impl AsRef<[u8]> for DescriptorId
impl AsRef<[u8]> for DescriptorId
source§impl Borrow<[u8]> for DescriptorId
impl Borrow<[u8]> for DescriptorId
source§impl Clone for DescriptorId
impl Clone for DescriptorId
source§fn clone(&self) -> DescriptorId
fn clone(&self) -> DescriptorId
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for DescriptorId
impl Debug for DescriptorId
source§impl<'de> Deserialize<'de> for DescriptorId
impl<'de> Deserialize<'de> for DescriptorId
source§fn deserialize<D: Deserializer<'de>>(d: D) -> Result<DescriptorId, D::Error>
fn deserialize<D: Deserializer<'de>>(d: D) -> Result<DescriptorId, D::Error>
Deserialize this value from the given Serde deserializer. Read more
source§impl Display for DescriptorId
impl Display for DescriptorId
source§impl From<DescriptorId> for Hash
impl From<DescriptorId> for Hash
source§fn from(hashtype: DescriptorId) -> Hash
fn from(hashtype: DescriptorId) -> Hash
Converts to this type from the input type.
source§impl From<Hash> for DescriptorId
impl From<Hash> for DescriptorId
source§fn from(inner: Hash) -> DescriptorId
fn from(inner: Hash) -> DescriptorId
Converts to this type from the input type.
source§impl FromStr for DescriptorId
impl FromStr for DescriptorId
source§impl Hash for DescriptorId
impl Hash for DescriptorId
source§impl Hash for DescriptorId
impl Hash for DescriptorId
§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§const DISPLAY_BACKWARD: bool = false
const DISPLAY_BACKWARD: bool = false
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§fn from_engine(e: Self::Engine) -> Self
fn from_engine(e: Self::Engine) -> Self
Produces a hash from the current state of a given engine.
source§fn from_slice(sl: &[u8]) -> Result<DescriptorId, FromSliceError>
fn from_slice(sl: &[u8]) -> Result<DescriptorId, FromSliceError>
Copies a byte slice into a hash object.
source§fn from_byte_array(bytes: Self::Bytes) -> Self
fn from_byte_array(bytes: Self::Bytes) -> Self
Constructs a hash from the underlying byte array.
source§fn to_byte_array(self) -> Self::Bytes
fn to_byte_array(self) -> Self::Bytes
Returns the underlying byte array.
source§fn as_byte_array(&self) -> &Self::Bytes
fn as_byte_array(&self) -> &Self::Bytes
Returns a reference to the underlying byte array.
§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<I: SliceIndex<[u8]>> Index<I> for DescriptorId
impl<I: SliceIndex<[u8]>> Index<I> for DescriptorId
source§impl LowerHex for DescriptorId
impl LowerHex for DescriptorId
source§impl Ord for DescriptorId
impl Ord for DescriptorId
source§fn cmp(&self, other: &DescriptorId) -> Ordering
fn cmp(&self, other: &DescriptorId) -> Ordering
1.21.0 · 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 PartialEq for DescriptorId
impl PartialEq for DescriptorId
source§fn eq(&self, other: &DescriptorId) -> bool
fn eq(&self, other: &DescriptorId) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for DescriptorId
impl PartialOrd for DescriptorId
source§fn partial_cmp(&self, other: &DescriptorId) -> Option<Ordering>
fn partial_cmp(&self, other: &DescriptorId) -> 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 moresource§impl SerdeHash for DescriptorId
impl SerdeHash for DescriptorId
source§fn from_slice_delegated(sl: &[u8]) -> Result<Self, FromSliceError>
fn from_slice_delegated(sl: &[u8]) -> Result<Self, FromSliceError>
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.
source§impl Serialize for DescriptorId
impl Serialize for DescriptorId
source§impl UpperHex for DescriptorId
impl UpperHex for DescriptorId
impl Copy for DescriptorId
impl Eq for DescriptorId
impl StructuralPartialEq for DescriptorId
Auto Trait Implementations§
impl Freeze for DescriptorId
impl RefUnwindSafe for DescriptorId
impl Send for DescriptorId
impl Sync for DescriptorId
impl Unpin for DescriptorId
impl UnwindSafe for DescriptorId
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
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more