pub struct Base64Bytes(pub Vec<u8>);
Expand description
Type for handling byte sequences as Base64-encoded strings
This type is used when you want to handle a byte sequence as a Base64-encoded string in JSON serialization, and then convert it back to a byte sequence when deserializing.
§Example
use mcp_attr::utils::Base64Bytes;
use serde_json::json;
let bytes = Base64Bytes(vec![1, 2, 3, 4, 5]);
let json = json!(bytes);
assert_eq!(json, json!("AQIDBAU="));
let bytes: Base64Bytes = serde_json::from_value(json).unwrap();
assert_eq!(bytes.0, vec![1, 2, 3, 4, 5]);
Tuple Fields§
§0: Vec<u8>
Trait Implementations§
Source§impl Clone for Base64Bytes
impl Clone for Base64Bytes
Source§fn clone(&self) -> Base64Bytes
fn clone(&self) -> Base64Bytes
Returns a copy 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 Debug for Base64Bytes
impl Debug for Base64Bytes
Source§impl Default for Base64Bytes
impl Default for Base64Bytes
Source§fn default() -> Base64Bytes
fn default() -> Base64Bytes
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for Base64Bytes
impl<'de> Deserialize<'de> for Base64Bytes
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
Source§impl From<Base64Bytes> for BlobResourceContents
impl From<Base64Bytes> for BlobResourceContents
Source§fn from(blob: Base64Bytes) -> Self
fn from(blob: Base64Bytes) -> Self
Converts to this type from the input type.
Source§impl From<Base64Bytes> for EmbeddedResourceResource
impl From<Base64Bytes> for EmbeddedResourceResource
Source§fn from(value: Base64Bytes) -> Self
fn from(value: Base64Bytes) -> Self
Converts to this type from the input type.
Source§impl From<Base64Bytes> for ReadResourceResult
impl From<Base64Bytes> for ReadResourceResult
Source§fn from(value: Base64Bytes) -> Self
fn from(value: Base64Bytes) -> Self
Converts to this type from the input type.
Source§impl From<Base64Bytes> for ReadResourceResultContentsItem
impl From<Base64Bytes> for ReadResourceResultContentsItem
Source§fn from(value: Base64Bytes) -> Self
fn from(value: Base64Bytes) -> Self
Converts to this type from the input type.
Source§impl From<Base64Bytes> for ServerResult
impl From<Base64Bytes> for ServerResult
Source§fn from(value: Base64Bytes) -> Self
fn from(value: Base64Bytes) -> Self
Converts to this type from the input type.
Source§impl Hash for Base64Bytes
impl Hash for Base64Bytes
Source§impl Ord for Base64Bytes
impl Ord for Base64Bytes
Source§fn cmp(&self, other: &Base64Bytes) -> Ordering
fn cmp(&self, other: &Base64Bytes) -> Ordering
1.21.0 · 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 PartialEq for Base64Bytes
impl PartialEq for Base64Bytes
Source§impl PartialOrd for Base64Bytes
impl PartialOrd for Base64Bytes
Source§impl Serialize for Base64Bytes
impl Serialize for Base64Bytes
impl Eq 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 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