pub struct Base64Bytes(pub Vec<u8>);Expand description
Raw bytes holding the base64-encoded ASCII representation of some payload.
Useful as a field type for x402 wire messages that transport arbitrary
binary data (for example, the raw Solana transaction wrapped in
PaymentPayload). Encoding is eager, decoding
is deferred.
§Examples
use r402_core::wire::Base64Bytes;
let encoded = Base64Bytes::encode(b"hello world");
let decoded = encoded.decode().unwrap();
assert_eq!(decoded, b"hello world");Tuple Fields§
§0: Vec<u8>Implementations§
Source§impl Base64Bytes
impl Base64Bytes
Sourcepub fn decode(&self) -> Result<Vec<u8>, DecodeError>
pub fn decode(&self) -> Result<Vec<u8>, DecodeError>
Decodes the inner base64 bytes into their raw binary form.
§Errors
Returns a base64::DecodeError when the stored bytes are not
valid base64.
Sourcepub fn encode<T: AsRef<[u8]>>(input: T) -> Self
pub fn encode<T: AsRef<[u8]>>(input: T) -> Self
Encodes arbitrary bytes into a Base64Bytes wrapper.
Trait Implementations§
Source§impl AsRef<[u8]> for Base64Bytes
impl AsRef<[u8]> for Base64Bytes
Source§impl Clone for Base64Bytes
impl Clone for Base64Bytes
Source§fn clone(&self) -> Base64Bytes
fn clone(&self) -> Base64Bytes
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Base64Bytes
impl Debug for Base64Bytes
Source§impl Display for Base64Bytes
impl Display for Base64Bytes
impl Eq for Base64Bytes
Source§impl From<&[u8]> for Base64Bytes
impl From<&[u8]> for Base64Bytes
Source§impl PartialEq for Base64Bytes
impl PartialEq for Base64Bytes
impl StructuralPartialEq for Base64Bytes
Auto Trait Implementations§
impl Freeze for Base64Bytes
impl RefUnwindSafe for Base64Bytes
impl Send for Base64Bytes
impl Sync for Base64Bytes
impl Unpin for Base64Bytes
impl UnsafeUnpin for Base64Bytes
impl UnwindSafe for Base64Bytes
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,
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