Struct casper_types::Gas
source · pub struct Gas(/* private fields */);
Expand description
The Gas
struct represents a U512
amount of gas.
Implementations§
source§impl Gas
impl Gas
sourcepub fn from_motes(motes: Motes, conv_rate: u64) -> Option<Self>
pub fn from_motes(motes: Motes, conv_rate: u64) -> Option<Self>
Converts the given motes
to Gas
by dividing them by conv_rate
.
Returns None
if conv_rate == 0
.
sourcepub fn checked_add(&self, rhs: Self) -> Option<Self>
pub fn checked_add(&self, rhs: Self) -> Option<Self>
Checked integer addition. Computes self + rhs
, returning None
if overflow occurred.
sourcepub fn checked_sub(&self, rhs: Self) -> Option<Self>
pub fn checked_sub(&self, rhs: Self) -> Option<Self>
Checked integer subtraction. Computes self - rhs
, returning None
if overflow occurred.
Trait Implementations§
source§impl AddAssign for Gas
impl AddAssign for Gas
source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
Performs the
+=
operation. Read moresource§impl<'de> Deserialize<'de> for Gas
impl<'de> Deserialize<'de> for Gas
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Ord for Gas
impl Ord for Gas
source§impl PartialOrd for Gas
impl PartialOrd for Gas
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 Gas
impl Eq for Gas
impl StructuralEq for Gas
impl StructuralPartialEq for Gas
Auto Trait Implementations§
impl RefUnwindSafe for Gas
impl Send for Gas
impl Sync for Gas
impl Unpin for Gas
impl UnwindSafe for Gas
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