Struct lightning_invoice::ExpiryTime [−][src]
pub struct ExpiryTime(_);
Positive duration that defines when (relatively to the timestamp) in the future the invoice expires
Invariants
The number of seconds this expiry time represents has to be in the range
0...(SYSTEM_TIME_MAX_UNIX_TIMESTAMP - MAX_EXPIRY_TIME)
to avoid overflows when adding it to a
timestamp
Implementations
impl ExpiryTime
[src]
impl ExpiryTime
[src]pub fn from_seconds(seconds: u64) -> Result<ExpiryTime, CreationError>
[src]
Construct an ExpiryTime
from seconds. If there exists a PositiveTimestamp
which would
overflow on adding the EpiryTime
to it then this function will return a
CreationError::ExpiryTimeOutOfBounds
.
pub fn from_duration(duration: Duration) -> Result<ExpiryTime, CreationError>
[src]
Construct an ExpiryTime
from a Duration
. If there exists a PositiveTimestamp
which
would overflow on adding the EpiryTime
to it then this function will return a
CreationError::ExpiryTimeOutOfBounds
.
pub fn as_seconds(&self) -> u64
[src]
Returns the expiry time in seconds
pub fn as_duration(&self) -> &Duration
[src]
Returns a reference to the underlying Duration
(=expiry time)
Trait Implementations
impl Base32Len for ExpiryTime
[src]
impl Base32Len for ExpiryTime
[src]fn base32_len(&self) -> usize
[src]
impl Clone for ExpiryTime
[src]
impl Clone for ExpiryTime
[src]fn clone(&self) -> ExpiryTime
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Eq for ExpiryTime
[src]
impl Eq for ExpiryTime
[src]impl FromBase32 for ExpiryTime
[src]
impl FromBase32 for ExpiryTime
[src]type Err = ParseError
The associated error which can be returned from parsing (e.g. because of bad padding).
fn from_base32(field_data: &[u5]) -> Result<ExpiryTime, ParseError>
[src]
impl PartialEq<ExpiryTime> for ExpiryTime
[src]
impl PartialEq<ExpiryTime> for ExpiryTime
[src]fn eq(&self, other: &ExpiryTime) -> bool
[src]
fn ne(&self, other: &ExpiryTime) -> bool
[src]
impl StructuralEq for ExpiryTime
[src]
impl StructuralEq for ExpiryTime
[src]impl StructuralPartialEq for ExpiryTime
[src]
impl StructuralPartialEq for ExpiryTime
[src]Auto Trait Implementations
impl RefUnwindSafe for ExpiryTime
impl RefUnwindSafe for ExpiryTime
impl Send for ExpiryTime
impl Send for ExpiryTime
impl Sync for ExpiryTime
impl Sync for ExpiryTime
impl Unpin for ExpiryTime
impl Unpin for ExpiryTime
impl UnwindSafe for ExpiryTime
impl UnwindSafe for ExpiryTime