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
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§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: 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§impl PartialOrd for DescriptorId
impl PartialOrd for DescriptorId
Source§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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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