[][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

Methods

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

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Eq for ExpiryTime
[src]

impl PartialEq<ExpiryTime> for ExpiryTime
[src]

impl Debug 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 ToBase32<Vec<u5>> for ExpiryTime
[src]

Auto Trait Implementations

impl Send for ExpiryTime

impl Sync for ExpiryTime

Blanket Implementations

impl<T> From for T
[src]

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

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

type Owned = T

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

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

impl<T> ToBase32 for T where
    T: AsRef<[u8]>, 
[src]

fn to_base32(&self) -> Vec<u5>
[src]

Convert base256 to base32, adds padding if necessary