Struct psbt::ProprietaryKey
source · pub struct ProprietaryKey<Subtype = u8>{
pub prefix: Vec<u8>,
pub subtype: Subtype,
pub key: Vec<u8>,
}
Expand description
Proprietary keys (i.e. keys starting with 0xFC byte) with their internal structure according to BIP 174.
Fields§
§prefix: Vec<u8>
Proprietary type prefix used for grouping together keys under some application and avoid namespace collision
subtype: Subtype
Custom proprietary subtype
key: Vec<u8>
Additional key bytes (like serialized public key data etc)
Implementations§
source§impl<Subtype> ProprietaryKey<Subtype>
impl<Subtype> ProprietaryKey<Subtype>
sourcepub fn from_key(key: Key) -> Result<ProprietaryKey<Subtype>, Error>
👎Deprecated since 0.29.0: use try_from instead
pub fn from_key(key: Key) -> Result<ProprietaryKey<Subtype>, Error>
Constructs ProprietaryKey from Key; returns
Error::InvalidProprietaryKey if key
do not starts with 0xFC byte
Trait Implementations§
source§impl<Subtype> Clone for ProprietaryKey<Subtype>
impl<Subtype> Clone for ProprietaryKey<Subtype>
source§fn clone(&self) -> ProprietaryKey<Subtype>
fn clone(&self) -> ProprietaryKey<Subtype>
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<Subtype> Debug for ProprietaryKey<Subtype>
impl<Subtype> Debug for ProprietaryKey<Subtype>
source§impl<Subtype> Decodable for ProprietaryKey<Subtype>
impl<Subtype> Decodable for ProprietaryKey<Subtype>
source§fn consensus_decode<R>(r: &mut R) -> Result<ProprietaryKey<Subtype>, Error>
fn consensus_decode<R>(r: &mut R) -> Result<ProprietaryKey<Subtype>, Error>
Decode an object with a well-defined format. Read more
source§impl<Subtype> Encodable for ProprietaryKey<Subtype>
impl<Subtype> Encodable for ProprietaryKey<Subtype>
source§impl From<&ProprietaryKeyDescriptor> for ProprietaryKey
impl From<&ProprietaryKeyDescriptor> for ProprietaryKey
source§fn from(key: &ProprietaryKeyDescriptor) -> Self
fn from(key: &ProprietaryKeyDescriptor) -> Self
Converts to this type from the input type.
source§impl From<ProprietaryKeyDescriptor> for ProprietaryKey
impl From<ProprietaryKeyDescriptor> for ProprietaryKey
source§fn from(key: ProprietaryKeyDescriptor) -> Self
fn from(key: ProprietaryKeyDescriptor) -> Self
Converts to this type from the input type.
source§impl<Subtype> Hash for ProprietaryKey<Subtype>
impl<Subtype> Hash for ProprietaryKey<Subtype>
source§impl<Subtype> Ord for ProprietaryKey<Subtype>
impl<Subtype> Ord for ProprietaryKey<Subtype>
source§fn cmp(&self, other: &ProprietaryKey<Subtype>) -> Ordering
fn cmp(&self, other: &ProprietaryKey<Subtype>) -> 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<Subtype> PartialEq for ProprietaryKey<Subtype>
impl<Subtype> PartialEq for ProprietaryKey<Subtype>
source§fn eq(&self, other: &ProprietaryKey<Subtype>) -> bool
fn eq(&self, other: &ProprietaryKey<Subtype>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl<Subtype> PartialOrd for ProprietaryKey<Subtype>
impl<Subtype> PartialOrd for ProprietaryKey<Subtype>
source§fn partial_cmp(&self, other: &ProprietaryKey<Subtype>) -> Option<Ordering>
fn partial_cmp(&self, other: &ProprietaryKey<Subtype>) -> 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 StrictDecode for ProprietaryKey
impl StrictDecode for ProprietaryKey
source§fn strict_decode<D>(d: D) -> Result<ProprietaryKey, Error>where
D: Read,
fn strict_decode<D>(d: D) -> Result<ProprietaryKey, Error>where
D: Read,
Decode with the given
std::io::Read
instance; must either
construct an instance or return implementation-specific error type.source§fn strict_deserialize(data: impl AsRef<[u8]>) -> Result<Self, Error>
fn strict_deserialize(data: impl AsRef<[u8]>) -> Result<Self, Error>
Tries to deserialize byte array into the current type using
StrictDecode::strict_decode
. If there are some data remains in the
buffer once deserialization is completed, fails with
Error::DataNotEntirelyConsumed
. Use io::Cursor
over the buffer and
StrictDecode::strict_decode
to avoid such failures.source§fn strict_file_load(path: impl AsRef<Path>) -> Result<Self, Error>
fn strict_file_load(path: impl AsRef<Path>) -> Result<Self, Error>
Reads data from file at
path
and reconstructs object from it. Fails
with Error::DataNotEntirelyConsumed
if file contains remaining
data after the object reconstruction.source§impl StrictEncode for ProprietaryKey
impl StrictEncode for ProprietaryKey
source§fn strict_encode<E>(&self, e: E) -> Result<usize, Error>where
E: Write,
fn strict_encode<E>(&self, e: E) -> Result<usize, Error>where
E: Write,
Encode with the given
std::io::Write
instance; must return result
with either amount of bytes encoded – or implementation-specific
error type.source§fn strict_serialize(&self) -> Result<Vec<u8>, Error>
fn strict_serialize(&self) -> Result<Vec<u8>, Error>
Serializes data as a byte array using
StrictEncode::strict_encode
functionsource§impl<Subtype> TryFrom<Key> for ProprietaryKey<Subtype>
impl<Subtype> TryFrom<Key> for ProprietaryKey<Subtype>
source§fn try_from(
key: Key
) -> Result<ProprietaryKey<Subtype>, <ProprietaryKey<Subtype> as TryFrom<Key>>::Error>
fn try_from( key: Key ) -> Result<ProprietaryKey<Subtype>, <ProprietaryKey<Subtype> as TryFrom<Key>>::Error>
Constructs a ProprietaryKey
from a Key
.
§Errors
Returns Error::InvalidProprietaryKey
if key
does not start with 0xFC
byte.
impl<Subtype> Eq for ProprietaryKey<Subtype>
impl<Subtype> StructuralPartialEq for ProprietaryKey<Subtype>
Auto Trait Implementations§
impl<Subtype> Freeze for ProprietaryKey<Subtype>where
Subtype: Freeze,
impl<Subtype> RefUnwindSafe for ProprietaryKey<Subtype>where
Subtype: RefUnwindSafe,
impl<Subtype> Send for ProprietaryKey<Subtype>where
Subtype: Send,
impl<Subtype> Sync for ProprietaryKey<Subtype>where
Subtype: Sync,
impl<Subtype> Unpin for ProprietaryKey<Subtype>where
Subtype: Unpin,
impl<Subtype> UnwindSafe for ProprietaryKey<Subtype>where
Subtype: UnwindSafe,
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