pub struct Preimage(/* private fields */);Expand description
A 32-byte secret preimage used for HTLC-based payments.
Implementations§
Source§impl Preimage
impl Preimage
Sourcepub fn to_byte_array(self) -> [u8; 32]
pub fn to_byte_array(self) -> [u8; 32]
Convert into underlying byte array.
Sourcepub fn from_byte_array(bytes: [u8; 32]) -> Self
pub fn from_byte_array(bytes: [u8; 32]) -> Self
Convert from byte array.
Sourcepub fn from_slice(slice: &[u8]) -> Result<Self, TryFromSliceError>
pub fn from_slice(slice: &[u8]) -> Result<Self, TryFromSliceError>
Create from byte slice.
Source§impl Preimage
impl Preimage
Sourcepub fn compute_payment_hash(&self) -> PaymentHash
pub fn compute_payment_hash(&self) -> PaymentHash
Hashes the preimage into the payment hash
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Preimage
impl<'de> Deserialize<'de> for Preimage
Source§fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
Source§impl<'a> DisplayHex for &'a Preimage
impl<'a> DisplayHex for &'a Preimage
Source§type Display = <&'a [u8; 32] as DisplayHex>::Display
type Display = <&'a [u8; 32] as DisplayHex>::Display
The type providing
fmt::Display implementation. Read moreSource§fn to_lower_hex_string(self) -> String
fn to_lower_hex_string(self) -> String
Create a lower-hex-encoded string. Read more
Source§fn to_upper_hex_string(self) -> String
fn to_upper_hex_string(self) -> String
Create an upper-hex-encoded string. Read more
Source§fn append_hex_to_string(self, case: Case, string: &mut String)
fn append_hex_to_string(self, case: Case, string: &mut String)
Appends hex-encoded content to an existing
String. Read moreSource§fn hex_reserve_suggestion(self) -> usize
fn hex_reserve_suggestion(self) -> usize
Hints how much bytes to reserve when creating a
String. Read moreSource§impl From<Preimage> for PaymentHash
impl From<Preimage> for PaymentHash
impl Copy for Preimage
impl Eq for Preimage
impl StructuralPartialEq for Preimage
Auto Trait Implementations§
impl Freeze for Preimage
impl RefUnwindSafe for Preimage
impl Send for Preimage
impl Sync for Preimage
impl Unpin for Preimage
impl UnwindSafe for Preimage
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