pub struct PubkeyScript(/* private fields */);
Expand description
A content of scriptPubkey
from a transaction output
Implementations§
Source§impl PubkeyScript
impl PubkeyScript
Sourcepub fn address(&self, network: Network) -> Option<Address>
pub fn address(&self, network: Network) -> Option<Address>
Generates an address matching the script and given network, if possible.
Address generation is not possible for bare bitcoin_scripts and P2PK; in
this case the function returns None
.
Sourcepub fn witness_version(&self) -> Option<WitnessVersion>
pub fn witness_version(&self) -> Option<WitnessVersion>
Returns witness version of the scriptPubkey
, if any
Trait Implementations§
Source§impl AsMut<<PubkeyScript as Wrapper>::Inner> for PubkeyScript
impl AsMut<<PubkeyScript as Wrapper>::Inner> for PubkeyScript
Source§impl AsRef<<PubkeyScript as Wrapper>::Inner> for PubkeyScript
impl AsRef<<PubkeyScript as Wrapper>::Inner> for PubkeyScript
Source§impl Borrow<<PubkeyScript as Wrapper>::Inner> for PubkeyScript
impl Borrow<<PubkeyScript as Wrapper>::Inner> for PubkeyScript
Source§impl BorrowMut<<PubkeyScript as Wrapper>::Inner> for PubkeyScript
impl BorrowMut<<PubkeyScript as Wrapper>::Inner> for PubkeyScript
Source§impl Clone for PubkeyScript
impl Clone for PubkeyScript
Source§fn clone(&self) -> PubkeyScript
fn clone(&self) -> PubkeyScript
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 PubkeyScript
impl Debug for PubkeyScript
Source§impl Default for PubkeyScript
impl Default for PubkeyScript
Source§fn default() -> PubkeyScript
fn default() -> PubkeyScript
Returns the “default value” for a type. Read more
Source§impl Deref for PubkeyScript
impl Deref for PubkeyScript
Source§impl DerefMut for PubkeyScript
impl DerefMut for PubkeyScript
Source§impl Display for PubkeyScript
impl Display for PubkeyScript
Source§impl From<AddressCompat> for PubkeyScript
impl From<AddressCompat> for PubkeyScript
Source§fn from(compact: AddressCompat) -> Self
fn from(compact: AddressCompat) -> Self
Converts to this type from the input type.
Source§impl From<AddressPayload> for PubkeyScript
impl From<AddressPayload> for PubkeyScript
Source§fn from(ap: AddressPayload) -> Self
fn from(ap: AddressPayload) -> Self
Converts to this type from the input type.
Source§impl From<PubkeyHash> for PubkeyScript
impl From<PubkeyHash> for PubkeyScript
Source§fn from(pkh: PubkeyHash) -> Self
fn from(pkh: PubkeyHash) -> Self
Converts to this type from the input type.
Source§impl From<PubkeyScript> for Script
impl From<PubkeyScript> for Script
Source§fn from(wrapped: PubkeyScript) -> Self
fn from(wrapped: PubkeyScript) -> Self
Converts to this type from the input type.
Source§impl From<Script> for PubkeyScript
impl From<Script> for PubkeyScript
Source§impl From<WPubkeyHash> for PubkeyScript
impl From<WPubkeyHash> for PubkeyScript
Source§fn from(wpkh: WPubkeyHash) -> Self
fn from(wpkh: WPubkeyHash) -> Self
Converts to this type from the input type.
Source§impl Hash for PubkeyScript
impl Hash for PubkeyScript
Source§impl LowerHex for PubkeyScript
impl LowerHex for PubkeyScript
Source§impl Ord for PubkeyScript
impl Ord for PubkeyScript
Source§fn cmp(&self, other: &PubkeyScript) -> Ordering
fn cmp(&self, other: &PubkeyScript) -> 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 PubkeyScript
impl PartialEq for PubkeyScript
Source§impl PartialOrd for PubkeyScript
impl PartialOrd for PubkeyScript
Source§impl Strategy for PubkeyScript
impl Strategy for PubkeyScript
Source§impl UpperHex for PubkeyScript
impl UpperHex for PubkeyScript
Source§impl Wrapper for PubkeyScript
impl Wrapper for PubkeyScript
Source§fn from_inner(inner: Self::Inner) -> Self
fn from_inner(inner: Self::Inner) -> Self
Instantiates wrapper type with the inner data
Source§fn as_inner(&self) -> &Self::Inner
fn as_inner(&self) -> &Self::Inner
Returns reference to the inner representation for the wrapper type
Source§fn as_inner_mut(&mut self) -> &mut Self::Inner
fn as_inner_mut(&mut self) -> &mut Self::Inner
Returns a mutable reference to the inner representation for the wrapper
type
Source§fn into_inner(self) -> Self::Inner
fn into_inner(self) -> Self::Inner
Unwraps the wrapper returning the inner type
impl Eq for PubkeyScript
impl StructuralPartialEq for PubkeyScript
Auto Trait Implementations§
impl Freeze for PubkeyScript
impl RefUnwindSafe for PubkeyScript
impl Send for PubkeyScript
impl Sync for PubkeyScript
impl Unpin for PubkeyScript
impl UnwindSafe for PubkeyScript
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,
Source§impl<T> StrictDecode for T
impl<T> StrictDecode for T
Source§fn strict_decode<D>(d: D) -> Result<T, Error>where
D: Read,
fn strict_decode<D>(d: D) -> Result<T, 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<T> StrictEncode for T
impl<T> StrictEncode for T
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
function