[][src]Struct lightning_invoice::ExpiryTime

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]

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 Clone for ExpiryTime[src]

impl Debug for ExpiryTime[src]

impl Eq 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).

impl PartialEq<ExpiryTime> for ExpiryTime[src]

impl StructuralEq for ExpiryTime[src]

impl StructuralPartialEq for ExpiryTime[src]

impl ToBase32 for ExpiryTime[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.