pub struct UncGas { /* private fields */ }
Implementations§
Source§impl UncGas
impl UncGas
Sourcepub const fn from_tgas(inner: u64) -> UncGas
pub const fn from_tgas(inner: u64) -> UncGas
Creates a new UncGas
from the specified number of whole tera Gas.
§Examples
use unc_gas::UncGas;
let tera_gas = UncGas::from_tgas(5);
assert_eq!(tera_gas.as_gas(), 5 * 1_000_000_000_000);
Sourcepub const fn from_ggas(inner: u64) -> UncGas
pub const fn from_ggas(inner: u64) -> UncGas
Creates a new UncGas
from the specified number of whole giga Gas.
§Examples
use unc_gas::UncGas;
let giga_gas = UncGas::from_ggas(5);
assert_eq!(giga_gas.as_gas(), 5 * 1_000_000_000);
Sourcepub const fn from_gas(inner: u64) -> UncGas
pub const fn from_gas(inner: u64) -> UncGas
Creates a new UncGas
from the specified number of whole Gas.
§Examples
use unc_gas::UncGas;
let gas = UncGas::from_gas(5 * 1_000_000_000_000);
assert_eq!(gas.as_tgas(), 5);
Sourcepub const fn as_gas(self) -> u64
pub const fn as_gas(self) -> u64
Returns the total number of whole Gas contained by this UncGas
.
§Examples
use unc_gas::UncGas;
let UncGas = UncGas::from_gas(12345);
assert_eq!(UncGas.as_gas(), 12345);
Sourcepub const fn as_ggas(self) -> u64
pub const fn as_ggas(self) -> u64
Returns the total number of a whole part of giga Gas contained by this UncGas
.
§Examples
use unc_gas::UncGas;
let UncGas = UncGas::from_gas(1 * 1_000_000_000);
assert_eq!(UncGas.as_ggas(), 1);
Sourcepub const fn as_tgas(self) -> u64
pub const fn as_tgas(self) -> u64
Returns the total number of a whole part of tera Gas contained by this UncGas
.
§Examples
use unc_gas::UncGas;
let UncGas = UncGas::from_gas(1 * 1_000_000_000_000);
assert_eq!(UncGas.as_tgas(), 1);
Sourcepub const fn checked_add(self, rhs: UncGas) -> Option<UncGas>
pub const fn checked_add(self, rhs: UncGas) -> Option<UncGas>
Checked integer addition. Computes self + rhs, returning None if overflow occurred.
§Examples
use unc_gas::UncGas;
use std::u64;
assert_eq!(UncGas::from_gas(u64::MAX -2).checked_add(UncGas::from_gas(2)), Some(UncGas::from_gas(u64::MAX)));
assert_eq!(UncGas::from_gas(u64::MAX -2).checked_add(UncGas::from_gas(3)), None);
Sourcepub const fn checked_sub(self, rhs: UncGas) -> Option<UncGas>
pub const fn checked_sub(self, rhs: UncGas) -> Option<UncGas>
Checked integer subtraction. Computes self - rhs, returning None if overflow occurred.
§Examples
use unc_gas::UncGas;
assert_eq!(UncGas::from_gas(2).checked_sub(UncGas::from_gas(2)), Some(UncGas::from_gas(0)));
assert_eq!(UncGas::from_gas(2).checked_sub(UncGas::from_gas(3)), None);
Sourcepub const fn checked_mul(self, rhs: u64) -> Option<UncGas>
pub const fn checked_mul(self, rhs: u64) -> Option<UncGas>
Checked integer multiplication. Computes self * rhs, returning None if overflow occurred.
§Examples
use unc_gas::UncGas;
use std::u64;
assert_eq!(UncGas::from_gas(2).checked_mul(2), Some(UncGas::from_gas(4)));
assert_eq!(UncGas::from_gas(u64::MAX).checked_mul(2), None)
Sourcepub const fn checked_div(self, rhs: u64) -> Option<UncGas>
pub const fn checked_div(self, rhs: u64) -> Option<UncGas>
Checked integer division. Computes self / rhs, returning None if rhs == 0.
§Examples
use unc_gas::UncGas;
assert_eq!(UncGas::from_gas(10).checked_div(2), Some(UncGas::from_gas(5)));
assert_eq!(UncGas::from_gas(2).checked_div(0), None);
Sourcepub const fn saturating_add(self, rhs: UncGas) -> UncGas
pub const fn saturating_add(self, rhs: UncGas) -> UncGas
Saturating integer addition. Computes self + rhs, saturating at the numeric bounds instead of overflowing.
§Examples
use unc_gas::UncGas;
assert_eq!(UncGas::from_gas(5).saturating_add(UncGas::from_gas(5)), UncGas::from_gas(10));
assert_eq!(UncGas::from_gas(u64::MAX).saturating_add(UncGas::from_gas(1)), UncGas::from_gas(u64::MAX));
Sourcepub const fn saturating_sub(self, rhs: UncGas) -> UncGas
pub const fn saturating_sub(self, rhs: UncGas) -> UncGas
Saturating integer subtraction. Computes self - rhs, saturating at the numeric bounds instead of overflowing.
§Examples
use unc_gas::UncGas;
assert_eq!(UncGas::from_gas(5).saturating_sub(UncGas::from_gas(2)), UncGas::from_gas(3));
assert_eq!(UncGas::from_gas(1).saturating_sub(UncGas::from_gas(2)), UncGas::from_gas(0));
Sourcepub const fn saturating_mul(self, rhs: u64) -> UncGas
pub const fn saturating_mul(self, rhs: u64) -> UncGas
Saturating integer multiplication. Computes self * rhs, saturating at the numeric bounds instead of overflowing.
§Examples
use unc_gas::UncGas;
use std::u64;
assert_eq!(UncGas::from_gas(2).saturating_mul(5), UncGas::from_gas(10));
assert_eq!(UncGas::from_gas(u64::MAX).saturating_mul(2), UncGas::from_gas(u64::MAX));
Sourcepub const fn saturating_div(self, rhs: u64) -> UncGas
pub const fn saturating_div(self, rhs: u64) -> UncGas
Saturating integer division. Computes self / rhs, saturating at the numeric bounds instead of overflowing.
§Examples
use unc_gas::UncGas;
assert_eq!(UncGas::from_gas(10).saturating_div(2), UncGas::from_gas(5));
assert_eq!(UncGas::from_gas(10).saturating_div(0), UncGas::from_gas(0))
Trait Implementations§
Source§impl BorshDeserialize for UncGas
impl BorshDeserialize for UncGas
fn deserialize_reader<R>(reader: &mut R) -> Result<UncGas, Error>where
R: Read,
Source§fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
Source§fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>where
R: Read,
Source§impl BorshSerialize for UncGas
impl BorshSerialize for UncGas
Source§impl<'de> Deserialize<'de> for UncGas
impl<'de> Deserialize<'de> for UncGas
Source§fn deserialize<D>(
deserializer: D,
) -> Result<UncGas, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<UncGas, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Source§impl Display for UncGas
UncGas Display implementation rounds up the gas usage to the relevant precision point.
There are 4 breakpoints:
impl Display for UncGas
UncGas Display implementation rounds up the gas usage to the relevant precision point. There are 4 breakpoints:
- exactly 0 Tgas
- <0.001 Tgas
- 0.001 - 0.999 Tgas (uses 3 digits after the floating point)
-
1 Tgas (uses 1 digit after the floating point)
Source§impl Ord for UncGas
impl Ord for UncGas
Source§impl PartialOrd for UncGas
impl PartialOrd for UncGas
Source§impl Serialize for UncGas
impl Serialize for UncGas
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,
impl Copy for UncGas
impl Eq for UncGas
impl StructuralPartialEq for UncGas
Auto Trait Implementations§
impl Freeze for UncGas
impl RefUnwindSafe for UncGas
impl Send for UncGas
impl Sync for UncGas
impl Unpin for UncGas
impl UnwindSafe for UncGas
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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
Source§impl<T> CallHasher for T
impl<T> CallHasher for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
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
key
and return true
if they are equal.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
key
and return true
if they are equal.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<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<D> OwoColorize for D
impl<D> OwoColorize for D
Source§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
Source§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
Source§fn black(&self) -> FgColorDisplay<'_, Black, Self>
fn black(&self) -> FgColorDisplay<'_, Black, Self>
Source§fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
Source§fn red(&self) -> FgColorDisplay<'_, Red, Self>
fn red(&self) -> FgColorDisplay<'_, Red, Self>
Source§fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
Source§fn green(&self) -> FgColorDisplay<'_, Green, Self>
fn green(&self) -> FgColorDisplay<'_, Green, Self>
Source§fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
Source§fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
Source§fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
Source§fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
Source§fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
Source§fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
Source§fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
Source§fn white(&self) -> FgColorDisplay<'_, White, Self>
fn white(&self) -> FgColorDisplay<'_, White, Self>
Source§fn on_white(&self) -> BgColorDisplay<'_, White, Self>
fn on_white(&self) -> BgColorDisplay<'_, White, Self>
Source§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
Source§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
Source§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
Source§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
Source§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
Source§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
Source§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
Source§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
Source§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
Source§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
Source§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
Source§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
Source§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
Source§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
Source§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
Source§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
Source§fn bold(&self) -> BoldDisplay<'_, Self>
fn bold(&self) -> BoldDisplay<'_, Self>
Source§fn dimmed(&self) -> DimDisplay<'_, Self>
fn dimmed(&self) -> DimDisplay<'_, Self>
Source§fn italic(&self) -> ItalicDisplay<'_, Self>
fn italic(&self) -> ItalicDisplay<'_, Self>
Source§fn underline(&self) -> UnderlineDisplay<'_, Self>
fn underline(&self) -> UnderlineDisplay<'_, Self>
Source§fn blink(&self) -> BlinkDisplay<'_, Self>
fn blink(&self) -> BlinkDisplay<'_, Self>
Source§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
Source§fn reversed(&self) -> ReversedDisplay<'_, Self>
fn reversed(&self) -> ReversedDisplay<'_, Self>
Source§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
Source§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg
or
a color-specific method, such as OwoColorize::green
, Read moreSource§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg
or
a color-specific method, such as OwoColorize::on_yellow
, Read more