pub struct U128(pub u128);Expand description
A u128 newtype that serializes as a decimal string in human-readable
formats (JSON / GraphQL) and as a bare u128 in binary (BCS).
Tuple Fields§
§0: u128Implementations§
Source§impl U128
impl U128
Sourcepub fn try_add(self, other: Self) -> Result<Self, ArithmeticError>
pub fn try_add(self, other: Self) -> Result<Self, ArithmeticError>
Checked addition.
Sourcepub fn try_add_one(self) -> Result<Self, ArithmeticError>
pub fn try_add_one(self) -> Result<Self, ArithmeticError>
Checked increment.
Sourcepub const fn saturating_add(self, other: Self) -> Self
pub const fn saturating_add(self, other: Self) -> Self
Saturating addition.
Sourcepub fn try_sub(self, other: Self) -> Result<Self, ArithmeticError>
pub fn try_sub(self, other: Self) -> Result<Self, ArithmeticError>
Checked subtraction.
Sourcepub fn try_sub_one(self) -> Result<Self, ArithmeticError>
pub fn try_sub_one(self) -> Result<Self, ArithmeticError>
Checked decrement.
Sourcepub const fn saturating_sub(self, other: Self) -> Self
pub const fn saturating_sub(self, other: Self) -> Self
Saturating subtraction.
Sourcepub fn abs_diff(self, other: Self) -> Self
pub fn abs_diff(self, other: Self) -> Self
Returns the absolute difference between self and other.
Sourcepub fn try_add_assign(&mut self, other: Self) -> Result<(), ArithmeticError>
pub fn try_add_assign(&mut self, other: Self) -> Result<(), ArithmeticError>
Checked in-place addition.
Sourcepub fn try_add_assign_one(&mut self) -> Result<(), ArithmeticError>
pub fn try_add_assign_one(&mut self) -> Result<(), ArithmeticError>
Checked in-place increment.
Sourcepub const fn saturating_add_assign(&mut self, other: Self)
pub const fn saturating_add_assign(&mut self, other: Self)
Saturating in-place addition.
Sourcepub fn try_sub_assign(&mut self, other: Self) -> Result<(), ArithmeticError>
pub fn try_sub_assign(&mut self, other: Self) -> Result<(), ArithmeticError>
Checked in-place subtraction.
Sourcepub fn saturating_div(&self, other: u128) -> Self
pub fn saturating_div(&self, other: u128) -> Self
Saturating division.
Sourcepub const fn saturating_mul(&self, other: u128) -> Self
pub const fn saturating_mul(&self, other: u128) -> Self
Saturating multiplication.
Sourcepub fn try_mul(self, other: u128) -> Result<Self, ArithmeticError>
pub fn try_mul(self, other: u128) -> Result<Self, ArithmeticError>
Checked multiplication.
Sourcepub fn try_mul_assign(&mut self, other: u128) -> Result<(), ArithmeticError>
pub fn try_mul_assign(&mut self, other: u128) -> Result<(), ArithmeticError>
Checked in-place multiplication.
Trait Implementations§
impl Copy for U128
Source§impl<'de> Deserialize<'de> for U128
impl<'de> Deserialize<'de> for U128
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
impl Eq for U128
Source§impl InputType for U128
impl InputType for U128
Source§type RawValueType = U128
type RawValueType = U128
The raw type used for validator. Read more
Source§fn create_type_info(registry: &mut Registry) -> String
fn create_type_info(registry: &mut Registry) -> String
Create type information in the registry and return qualified typename.
Source§fn parse(value: Option<Value>) -> InputValueResult<Self>
fn parse(value: Option<Value>) -> InputValueResult<Self>
Parse from
Value. None represents undefined.Source§fn as_raw_value(&self) -> Option<&Self::RawValueType>
fn as_raw_value(&self) -> Option<&Self::RawValueType>
Returns a reference to the raw value.
Source§fn qualified_type_name() -> String
fn qualified_type_name() -> String
Qualified typename.
Source§impl Ord for U128
impl Ord for U128
1.21.0 (const: unstable) · 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 OutputType for U128
impl OutputType for U128
Source§fn create_type_info(registry: &mut Registry) -> String
fn create_type_info(registry: &mut Registry) -> String
Create type information in the registry and return qualified typename.
Source§async fn resolve(
&self,
_: &ContextSelectionSet<'_>,
_field: &Positioned<Field>,
) -> ServerResult<Value>
async fn resolve( &self, _: &ContextSelectionSet<'_>, _field: &Positioned<Field>, ) -> ServerResult<Value>
Resolve an output value to
async_graphql::Value.Source§fn qualified_type_name() -> String
fn qualified_type_name() -> String
Qualified typename.
Source§impl PartialOrd for U128
impl PartialOrd for U128
Source§impl ScalarType for U128
impl ScalarType for U128
impl StructuralPartialEq for U128
Auto Trait Implementations§
impl Freeze for U128
impl RefUnwindSafe for U128
impl Send for U128
impl Sync for U128
impl Unpin for U128
impl UnsafeUnpin for U128
impl UnwindSafe for U128
Blanket Implementations§
impl<_INNER> AutoTraits for _INNER
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> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Choices> CoproductSubsetter<CNil, HNil> for Choices
impl<Choices> CoproductSubsetter<CNil, HNil> for Choices
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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.Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
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> ⓘ
Converts
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> ⓘ
Converts
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 moreimpl<T> MaybeSend for Twhere
T: Send,
impl<T> MaybeSync for Twhere
T: Sync,
impl<T> RuleType for T
Source§impl<M, I> RuntimeMemory<&mut I> for Mwhere
M: RuntimeMemory<I>,
impl<M, I> RuntimeMemory<&mut I> for Mwhere
M: RuntimeMemory<I>,
Source§fn read<'instance>(
&self,
instance: &'instance &mut I,
location: GuestPointer,
length: u32,
) -> Result<Cow<'instance, [u8]>, RuntimeError>
fn read<'instance>( &self, instance: &'instance &mut I, location: GuestPointer, length: u32, ) -> Result<Cow<'instance, [u8]>, RuntimeError>
Reads length bytes from memory from the provided location.
Source§fn write(
&mut self,
instance: &mut &mut I,
location: GuestPointer,
bytes: &[u8],
) -> Result<(), RuntimeError>
fn write( &mut self, instance: &mut &mut I, location: GuestPointer, bytes: &[u8], ) -> Result<(), RuntimeError>
Writes the bytes to memory at the provided location.