Struct lightning_invoice::ExpiryTime
source · pub struct ExpiryTime(_);
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
§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<ExpiryTime> for ExpiryTime
impl PartialEq<ExpiryTime> for ExpiryTime
source§fn eq(&self, other: &ExpiryTime) -> bool
fn eq(&self, other: &ExpiryTime) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd<ExpiryTime> for ExpiryTime
impl PartialOrd<ExpiryTime> for ExpiryTime
source§fn partial_cmp(&self, other: &ExpiryTime) -> Option<Ordering>
fn partial_cmp(&self, other: &ExpiryTime) -> 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 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 StructuralEq for ExpiryTime
impl StructuralPartialEq for ExpiryTime
Auto Trait Implementations§
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