pub struct U128<const VAL: u128>;Expand description
Marker type for passing const VAL: u128 as a type parameter.
§Serde compatibility
When the "serde" feature is enabled,
this type is serialized/deserialized as the VAL const parameter.
ⓘ
use typewit::const_marker::U128;
assert_eq!(serde_json::from_str::<U128<1>>("1").unwrap(), U128::<1>);
// trying to deserialize `U128<1>` from any value other than `1` produces an error
assert!(serde_json::from_str::<U128<1>>("0").is_err());
assert_eq!(serde_json::to_string(&U128::<1>).unwrap(), "1");
assert_eq!(serde_json::to_string(&U128::<92>).unwrap(), "92");
Implementations§
Source§impl<const VAL: u128> U128<VAL>
impl<const VAL: u128> U128<VAL>
Sourcepub const fn eq<const OTHER: u128>(
self,
_other: U128<OTHER>,
) -> Result<TypeEq<U128<VAL>, U128<OTHER>>, TypeNe<U128<VAL>, U128<OTHER>>>
👎Deprecated since 1.8.0: superceeded by equals method
pub const fn eq<const OTHER: u128>( self, _other: U128<OTHER>, ) -> Result<TypeEq<U128<VAL>, U128<OTHER>>, TypeNe<U128<VAL>, U128<OTHER>>>
superceeded by equals method
Compares self and other for equality.
Returns:
Ok(TypeEq): ifVAL == OTHERErr(TypeNe): ifVAL != OTHER
Trait Implementations§
Source§impl<const VAL: u128> ConstMarker for U128<VAL>
impl<const VAL: u128> ConstMarker for U128<VAL>
Source§impl<const VAL: u128> Ord for U128<VAL>
impl<const VAL: u128> Ord for U128<VAL>
Source§impl<const L: u128, const R: u128> PartialOrd<U128<R>> for U128<L>
impl<const L: u128, const R: u128> PartialOrd<U128<R>> for U128<L>
impl<const VAL: u128> Copy for U128<VAL>
impl<const VAL: u128> Eq for U128<VAL>
Auto Trait Implementations§
impl<const VAL: u128> Freeze for U128<VAL>
impl<const VAL: u128> RefUnwindSafe for U128<VAL>
impl<const VAL: u128> Send for U128<VAL>
impl<const VAL: u128> Sync for U128<VAL>
impl<const VAL: u128> Unpin for U128<VAL>
impl<const VAL: u128> UnsafeUnpin for U128<VAL>
impl<const VAL: u128> UnwindSafe for U128<VAL>
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