Trait ScriptHashExtension

Source
pub trait ScriptHashExtension
where Self: Sized,
{ // Required methods fn to_bs58_string(&self) -> String; fn zero() -> Self; fn from_slice(slice: &[u8]) -> Result<Self, TypeError>; fn from_hex(hex: &str) -> Result<Self, FromHexError>; fn from_address(address: &str) -> Result<Self, TypeError>; fn to_address(&self) -> String; fn to_hex(&self) -> String; fn to_hex_big_endian(&self) -> String; fn to_vec(&self) -> Vec<u8> ; fn to_le_vec(&self) -> Vec<u8> ; fn from_script(script: &[u8]) -> Self; fn from_public_key(public_key: &[u8]) -> Result<Self, TypeError>; }
Expand description

Trait that provides additional methods for types related to ScriptHash.

Required Methods§

Source

fn to_bs58_string(&self) -> String

Returns a string representation of the object.

Source

fn zero() -> Self

Creates an instance for a zero-value hash. Returns a zero-value hash

Source

fn from_slice(slice: &[u8]) -> Result<Self, TypeError>

Creates an instance from a byte slice.

§Errors

Returns an error if the slice has an invalid length.

Source

fn from_hex(hex: &str) -> Result<Self, FromHexError>

Creates an instance from a hex string.

§Errors

Returns an error if the hex string is invalid.

Source

fn from_address(address: &str) -> Result<Self, TypeError>

Creates an instance from an address string representation.

§Errors

Returns an error if the address is invalid.

Source

fn to_address(&self) -> String

Converts the object into its address string representation.

Source

fn to_hex(&self) -> String

Converts the object into its hex string representation.

Source

fn to_hex_big_endian(&self) -> String

Converts the object into its hex string representation.

Source

fn to_vec(&self) -> Vec<u8>

Converts the object into a byte vector.

Source

fn to_le_vec(&self) -> Vec<u8>

Converts the object into a little-endian byte vector.

Source

fn from_script(script: &[u8]) -> Self

Creates an instance from a script byte slice.

Source

fn from_public_key(public_key: &[u8]) -> Result<Self, TypeError>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§