#[repr(transparent)]pub struct MaxQuantity(pub NonZero<u64>);Expand description
The max number of items that can be purchased in one payment with the offer.
The expected amount paid for this offer is offer.amount * quantity,
where offer.amount is the amount per item and quantity is the
number of items chosen by the payer. The payer’s chosen quantity must be
in the range: 0 < quantity <= offer.max_quantity.
NOTE: this is NOT related to reusable vs single-use offers.
This type is effectively LDK’s Quantity type but serde serializable. We
also use u64::MAX to represent “unbounded” quantity. This makes the
CreateOfferRequest serialization simpler, since max_quantity should be
an optional field and Option<Option<NonZeroU64>> has a strange
serialization.
See: CreateOfferRequest::max_quantity.
Tuple Fields§
§0: NonZero<u64>Implementations§
Source§impl MaxQuantity
impl MaxQuantity
pub const ONE: MaxQuantity
pub const UNBOUNDED: MaxQuantity
Trait Implementations§
Source§impl Clone for MaxQuantity
impl Clone for MaxQuantity
Source§fn clone(&self) -> MaxQuantity
fn clone(&self) -> MaxQuantity
Returns a duplicate 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 Default for MaxQuantity
impl Default for MaxQuantity
Source§fn default() -> MaxQuantity
fn default() -> MaxQuantity
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for MaxQuantity
impl<'de> Deserialize<'de> for MaxQuantity
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<MaxQuantity, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<MaxQuantity, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<Quantity> for MaxQuantity
impl From<Quantity> for MaxQuantity
Source§fn from(value: Quantity) -> MaxQuantity
fn from(value: Quantity) -> MaxQuantity
Converts to this type from the input type.
Source§impl PartialEq for MaxQuantity
impl PartialEq for MaxQuantity
Source§impl Serialize for MaxQuantity
impl Serialize for MaxQuantity
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl Copy for MaxQuantity
impl Eq for MaxQuantity
impl StructuralPartialEq for MaxQuantity
Auto Trait Implementations§
impl Freeze for MaxQuantity
impl RefUnwindSafe for MaxQuantity
impl Send for MaxQuantity
impl Sync for MaxQuantity
impl Unpin for MaxQuantity
impl UnsafeUnpin for MaxQuantity
impl UnwindSafe for MaxQuantity
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§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.