Struct fuel_tx::TransactionFee
source · pub struct TransactionFee { /* private fields */ }
Implementations
sourceimpl 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
sourceimpl Clone for TransactionFee
impl Clone for TransactionFee
sourcefn clone(&self) -> TransactionFee
fn clone(&self) -> TransactionFee
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl Debug for TransactionFee
impl Debug for TransactionFee
sourceimpl Default for TransactionFee
impl Default for TransactionFee
sourcefn default() -> TransactionFee
fn default() -> TransactionFee
Returns the “default value” for a type. Read more
sourceimpl From<TransactionFee> for Word
impl From<TransactionFee> for Word
sourcefn from(fee: TransactionFee) -> Word
fn from(fee: TransactionFee) -> Word
Converts to this type from the input type.
sourceimpl Hash for TransactionFee
impl Hash for TransactionFee
sourceimpl Ord for TransactionFee
impl Ord for TransactionFee
sourcefn cmp(&self, other: &TransactionFee) -> Ordering
fn cmp(&self, other: &TransactionFee) -> Ordering
1.21.0 · sourcefn 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
1.21.0 · sourcefn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Selfwhere
Self: Sized + PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: Sized + PartialOrd<Self>,
Restrict a value to a certain interval. Read more
sourceimpl PartialEq<TransactionFee> for TransactionFee
impl PartialEq<TransactionFee> for TransactionFee
sourcefn eq(&self, other: &TransactionFee) -> bool
fn eq(&self, other: &TransactionFee) -> bool
sourceimpl PartialOrd<TransactionFee> for TransactionFee
impl PartialOrd<TransactionFee> for TransactionFee
sourcefn partial_cmp(&self, other: &TransactionFee) -> Option<Ordering>
fn partial_cmp(&self, other: &TransactionFee) -> Option<Ordering>
1.0.0 · sourcefn 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
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more