pub struct U64String(/* private fields */);Expand description
A u64 that serializes as a JSON string.
JSON integer parsing in the browser (JavaScript Number) is limited
to 2⁵³ bits. x402 wraps u64-sized fields in strings to guarantee
exact precision across runtimes.
§Examples
use r402_core::wire::U64String;
let value = U64String::from(42_u64);
assert_eq!(value.inner(), 42);
assert_eq!(serde_json::to_string(&value).unwrap(), r#""42""#);
let parsed: U64String = serde_json::from_str(r#""42""#).unwrap();
assert_eq!(parsed.inner(), 42);Implementations§
Trait Implementations§
impl Copy for U64String
Source§impl<'de> Deserialize<'de> for U64String
impl<'de> Deserialize<'de> for U64String
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 U64String
impl StructuralPartialEq for U64String
Auto Trait Implementations§
impl Freeze for U64String
impl RefUnwindSafe for U64String
impl Send for U64String
impl Sync for U64String
impl Unpin for U64String
impl UnsafeUnpin for U64String
impl UnwindSafe for U64String
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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§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> 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> Pointable for T
impl<T> Pointable for T
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
Fallible version of
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
Converts the given value to a
CompactString. Read more