Struct fuel_tx::TransactionFee
source · pub struct TransactionFee { /* private fields */ }
Implementations§
source§impl TransactionFee
impl TransactionFee
pub const fn new(bytes: Word, total: Word, min_gas: Word, max_gas: Word) -> Self
sourcepub const fn total(&self) -> Word
pub const fn total(&self) -> Word
Maximum fee value composed of metered bytes cost + tx gas limit, with price factor correction
sourcepub const fn into_inner(self) -> (Word, Word)
pub const fn into_inner(self) -> (Word, Word)
Convert into a tuple containing the inner min & total fee values
sourcepub fn checked_deduct_total(&self, balance: Word) -> Option<Word>
pub fn checked_deduct_total(&self, balance: Word) -> Option<Word>
Attempt to subtract the maximum fee value from a given balance
Will return None
if arithmetic overflow occurs.
sourcepub fn checked_from_values(
params: &ConsensusParameters,
metered_bytes: Word,
gas_limit: Word,
gas_price: Word
) -> Option<Self>
pub fn checked_from_values( params: &ConsensusParameters, metered_bytes: Word, gas_limit: Word, gas_price: Word ) -> Option<Self>
Attempt to create a transaction fee from parameters and value arguments
Will return None
if arithmetic overflow occurs.
sourcepub fn gas_refund_value(
params: &ConsensusParameters,
gas: Word,
price: Word
) -> Option<Word>
pub fn gas_refund_value( params: &ConsensusParameters, gas: Word, price: Word ) -> Option<Word>
Attempt to calculate a gas as asset value, using the price factor defined in the consensus parameters.
Will return None
if overflow occurs
sourcepub fn checked_from_tx<T: Chargeable>(
params: &ConsensusParameters,
tx: &T
) -> Option<Self>
pub fn checked_from_tx<T: Chargeable>( params: &ConsensusParameters, tx: &T ) -> Option<Self>
Attempt to create a transaction fee from parameters and transaction internals
Will return None
if arithmetic overflow occurs.
Trait Implementations§
source§impl Clone for TransactionFee
impl Clone for TransactionFee
source§fn clone(&self) -> TransactionFee
fn clone(&self) -> TransactionFee
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 TransactionFee
impl Debug for TransactionFee
source§impl Default for TransactionFee
impl Default for TransactionFee
source§fn default() -> TransactionFee
fn default() -> TransactionFee
Returns the “default value” for a type. Read more
source§impl From<TransactionFee> for Word
impl From<TransactionFee> for Word
source§fn from(fee: TransactionFee) -> Word
fn from(fee: TransactionFee) -> Word
Converts to this type from the input type.
source§impl Hash for TransactionFee
impl Hash for TransactionFee
source§impl Ord for TransactionFee
impl Ord for TransactionFee
source§fn cmp(&self, other: &TransactionFee) -> Ordering
fn cmp(&self, other: &TransactionFee) -> 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<TransactionFee> for TransactionFee
impl PartialEq<TransactionFee> for TransactionFee
source§fn eq(&self, other: &TransactionFee) -> bool
fn eq(&self, other: &TransactionFee) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd<TransactionFee> for TransactionFee
impl PartialOrd<TransactionFee> for TransactionFee
source§fn partial_cmp(&self, other: &TransactionFee) -> Option<Ordering>
fn partial_cmp(&self, other: &TransactionFee) -> 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 moreimpl Copy for TransactionFee
impl Eq for TransactionFee
impl StructuralEq for TransactionFee
impl StructuralPartialEq for TransactionFee
Auto Trait Implementations§
impl RefUnwindSafe for TransactionFee
impl Send for TransactionFee
impl Sync for TransactionFee
impl Unpin for TransactionFee
impl UnwindSafe for TransactionFee
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
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more