Struct lightning_invoice::ExpiryTime
source · pub struct ExpiryTime(/* private fields */);
Expand description
Positive duration that defines when (relatively to the timestamp) in the future the invoice expires
Implementations§
source§impl ExpiryTime
impl ExpiryTime
sourcepub fn from_seconds(seconds: u64) -> ExpiryTime
pub fn from_seconds(seconds: u64) -> ExpiryTime
Construct an ExpiryTime
from seconds.
sourcepub fn from_duration(duration: Duration) -> ExpiryTime
pub fn from_duration(duration: Duration) -> ExpiryTime
Construct an ExpiryTime
from a Duration
, dropping the sub-second part.
sourcepub fn as_seconds(&self) -> u64
pub fn as_seconds(&self) -> u64
Returns the expiry time in seconds
sourcepub fn as_duration(&self) -> &Duration
pub fn as_duration(&self) -> &Duration
Returns a reference to the underlying Duration
(=expiry time)
Trait Implementations§
source§impl Base32Len for ExpiryTime
impl Base32Len for ExpiryTime
source§fn base32_len(&self) -> usize
fn base32_len(&self) -> usize
Calculate the base32 serialized length
source§impl Clone for ExpiryTime
impl Clone for ExpiryTime
source§fn clone(&self) -> ExpiryTime
fn clone(&self) -> ExpiryTime
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 ExpiryTime
impl Debug for ExpiryTime
source§impl FromBase32 for ExpiryTime
impl FromBase32 for ExpiryTime
source§type Err = Bolt11ParseError
type Err = Bolt11ParseError
The associated error which can be returned from parsing (e.g. because of bad padding).
source§fn from_base32(field_data: &[u5]) -> Result<ExpiryTime, Bolt11ParseError>
fn from_base32(field_data: &[u5]) -> Result<ExpiryTime, Bolt11ParseError>
Convert a base32 slice to
Self
.source§impl Hash for ExpiryTime
impl Hash for ExpiryTime
source§impl Ord for ExpiryTime
impl Ord for ExpiryTime
source§fn cmp(&self, other: &ExpiryTime) -> Ordering
fn cmp(&self, other: &ExpiryTime) -> 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 ExpiryTime
impl PartialEq for ExpiryTime
source§impl PartialOrd for ExpiryTime
impl PartialOrd for ExpiryTime
source§impl ToBase32 for ExpiryTime
impl ToBase32 for ExpiryTime
source§fn write_base32<W: WriteBase32>(
&self,
writer: &mut W,
) -> Result<(), <W as WriteBase32>::Err>
fn write_base32<W: WriteBase32>( &self, writer: &mut W, ) -> Result<(), <W as WriteBase32>::Err>
Encode as base32 and write it to the supplied writer
Implementations shouldn’t allocate.
impl Eq for ExpiryTime
impl StructuralPartialEq for ExpiryTime
Auto Trait Implementations§
impl Freeze for ExpiryTime
impl RefUnwindSafe for ExpiryTime
impl Send for ExpiryTime
impl Sync for ExpiryTime
impl Unpin for ExpiryTime
impl UnwindSafe for ExpiryTime
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)