pub struct Base64String(/* private fields */);Expand description
Base64-encoded string
Represents a Base64-encoded binary data string.
§Examples
use turbomcp_protocol::types::domain::Base64String;
let b64 = Base64String::new("SGVsbG8gV29ybGQh").unwrap();
assert_eq!(b64.as_str(), "SGVsbG8gV29ybGQh");
// Invalid Base64 (contains invalid characters)
assert!(Base64String::new("not valid!@#").is_err());Implementations§
Source§impl Base64String
impl Base64String
Sourcepub fn new<S: Into<String>>(data: S) -> Result<Self, Base64Error>
pub fn new<S: Into<String>>(data: S) -> Result<Self, Base64Error>
Create a new Base64 string with validation
§Errors
Returns an error if the string contains invalid Base64 characters
Sourcepub fn new_unchecked<S: Into<String>>(data: S) -> Self
pub fn new_unchecked<S: Into<String>>(data: S) -> Self
Create a Base64 string without validation
Sourcepub fn into_inner(self) -> String
pub fn into_inner(self) -> String
Convert into the inner String
Trait Implementations§
Source§impl AsRef<str> for Base64String
impl AsRef<str> for Base64String
Source§impl Clone for Base64String
impl Clone for Base64String
Source§fn clone(&self) -> Base64String
fn clone(&self) -> Base64String
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 Debug for Base64String
impl Debug for Base64String
Source§impl<'de> Deserialize<'de> for Base64String
impl<'de> Deserialize<'de> for Base64String
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 Display for Base64String
impl Display for Base64String
Source§impl From<Base64String> for String
impl From<Base64String> for String
Source§fn from(b64: Base64String) -> Self
fn from(b64: Base64String) -> Self
Converts to this type from the input type.
Source§impl Hash for Base64String
impl Hash for Base64String
Source§impl PartialEq for Base64String
impl PartialEq for Base64String
Source§impl Serialize for Base64String
impl Serialize for Base64String
impl Eq for Base64String
impl StructuralPartialEq for Base64String
Auto Trait Implementations§
impl Freeze for Base64String
impl RefUnwindSafe for Base64String
impl Send for Base64String
impl Sync for Base64String
impl Unpin for Base64String
impl UnwindSafe for Base64String
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§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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.