pub struct Base64Bytes<'a>(pub Cow<'a, [u8]>);Expand description
A wrapper for base64-encoded byte data.
This type holds bytes that represent base64-encoded data and provides methods for encoding and decoding. It uses copy-on-write semantics to avoid unnecessary allocations.
§Example
use x402_types::util::Base64Bytes;
// Encode some data
let encoded = Base64Bytes::encode(b"hello world");
assert_eq!(encoded.to_string(), "aGVsbG8gd29ybGQ=");
// Decode it back
let decoded = encoded.decode().unwrap();
assert_eq!(decoded, b"hello world");Tuple Fields§
§0: Cow<'a, [u8]>Implementations§
Source§impl Base64Bytes<'_>
impl Base64Bytes<'_>
Trait Implementations§
Source§impl AsRef<[u8]> for Base64Bytes<'_>
impl AsRef<[u8]> for Base64Bytes<'_>
Source§impl<'a> Clone for Base64Bytes<'a>
impl<'a> Clone for Base64Bytes<'a>
Source§fn clone(&self) -> Base64Bytes<'a>
fn clone(&self) -> Base64Bytes<'a>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<'a> Debug for Base64Bytes<'a>
impl<'a> Debug for Base64Bytes<'a>
Source§impl Display for Base64Bytes<'_>
impl Display for Base64Bytes<'_>
Source§impl<'a> From<&'a [u8]> for Base64Bytes<'a>
impl<'a> From<&'a [u8]> for Base64Bytes<'a>
Source§impl<'a> PartialEq for Base64Bytes<'a>
impl<'a> PartialEq for Base64Bytes<'a>
impl<'a> Eq for Base64Bytes<'a>
impl<'a> StructuralPartialEq for Base64Bytes<'a>
Auto Trait Implementations§
impl<'a> Freeze for Base64Bytes<'a>
impl<'a> RefUnwindSafe for Base64Bytes<'a>
impl<'a> Send for Base64Bytes<'a>
impl<'a> Sync for Base64Bytes<'a>
impl<'a> Unpin for Base64Bytes<'a>
impl<'a> UnwindSafe for Base64Bytes<'a>
Blanket Implementations§
Source§impl<T> ToHex for T
impl<T> ToHex for T
Source§fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
👎Deprecated: use
ToHexExt insteadEncode the hex strict representing
self into the result.
Lower case letters are used (e.g. f9b4ca).Source§fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
👎Deprecated: use
ToHexExt insteadEncode the hex strict representing
self into the result.
Upper case letters are used (e.g. F9B4CA).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§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> ToHexExt for T
impl<T> ToHexExt for T
Source§fn encode_hex(&self) -> String
fn encode_hex(&self) -> String
Encode the hex strict representing
self into the result.
Lower case letters are used (e.g. f9b4ca).Source§fn encode_hex_upper(&self) -> String
fn encode_hex_upper(&self) -> String
Encode the hex strict representing
self into the result.
Upper case letters are used (e.g. F9B4CA).Source§fn encode_hex_with_prefix(&self) -> String
fn encode_hex_with_prefix(&self) -> String
Encode the hex strict representing
self into the result with prefix 0x.
Lower case letters are used (e.g. 0xf9b4ca).Source§fn encode_hex_upper_with_prefix(&self) -> String
fn encode_hex_upper_with_prefix(&self) -> String
Encode the hex strict representing
self into the result with prefix 0X.
Upper case letters are used (e.g. 0xF9B4CA).