Struct aliri_base64::Base64Url [−][src]
#[repr(transparent)]pub struct Base64Url(_);
Owned data to be encoded as URL-safe base64 (no padding)
Encoding alphabet: A
–Z
, a
–z
, 0
–9
, -
, _
Data is held in memory in its raw form. Costs of serialization are only incurred when serializing or displaying the value in its base64 representation.
Implementations of the From
trait assume that assume that the
underlying structure is in raw form.
Implementations
impl Base64Url
[src]
impl Base64Url
[src]pub const fn new() -> Self
[src]
Creates an empty buffer
pub fn from_raw<T: Into<Vec<u8>>>(raw: T) -> Self
[src]
Creates a new buffer from an owned value
This function has no cost for Vec<u8>
. Other types incur
the cost of copying into a buffer.
To decode a base64-encoded buffer, use from_encoded()
.
pub fn from_encoded<T: AsRef<[u8]>>(enc: T) -> Result<Self, InvalidBase64Data>
[src]
Constructs a new buffer from a base64-encoded slice
This function will decode the slice into a new owned buffer.
If the underlying buffer has already been decoded, then
transparently wrap the buffer using from_raw()
.
pub fn into_inner(self) -> Vec<u8>
[src]
Unwraps the underlying buffer
pub fn as_vec(&self) -> &Vec<u8>
[src]
Provides access to the underlying buffer as a vector
pub fn as_vec_mut(&mut self) -> &mut Vec<u8>
[src]
Provides mutable access to the underlying buffer as a vector
pub const fn calc_encoded_len(len: usize) -> usize
[src]
Calculates the expected length of the base64-encoding for a buffer of size len
Methods from Deref<Target = Base64UrlRef>
pub const fn encoded_len(&self) -> usize
[src]
Calculates the expected length of the base64-encoding of this buffer
pub const fn as_slice(&self) -> &[u8]
[src]
Provides access to the underlying slice
pub fn as_mut_slice(&mut self) -> &mut [u8]
[src]
Provides mutable access to the underlying slice
Trait Implementations
impl AsRef<Base64UrlRef> for Base64Url
[src]
impl AsRef<Base64UrlRef> for Base64Url
[src]fn as_ref(&self) -> &Base64UrlRef
[src]
impl Borrow<Base64UrlRef> for Base64Url
[src]
impl Borrow<Base64UrlRef> for Base64Url
[src]fn borrow(&self) -> &Base64UrlRef
[src]
impl Deref for Base64Url
[src]
impl Deref for Base64Url
[src]type Target = Base64UrlRef
The resulting type after dereferencing.
fn deref(&self) -> &Self::Target
[src]
impl<'de> Deserialize<'de> for Base64Url
[src]
impl<'de> Deserialize<'de> for Base64Url
[src]serde
only.Deserialize a base64 string and decode it into a byte array
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
[src]
impl From<&'_ Base64UrlRef> for Base64Url
[src]
impl From<&'_ Base64UrlRef> for Base64Url
[src]fn from(val: &Base64UrlRef) -> Self
[src]
impl PartialEq<Base64Url> for Base64UrlRef
[src]
impl PartialEq<Base64Url> for Base64UrlRef
[src]impl PartialEq<Base64UrlRef> for Base64Url
[src]
impl PartialEq<Base64UrlRef> for Base64Url
[src]impl Serialize for Base64Url
[src]
impl Serialize for Base64Url
[src]serde
only.Serialize the underlying byte array as a base64 string
impl StructuralEq for Base64Url
[src]
impl StructuralEq for Base64Url
[src]impl StructuralPartialEq for Base64Url
[src]
impl StructuralPartialEq for Base64Url
[src]Auto Trait Implementations
impl RefUnwindSafe for Base64Url
impl RefUnwindSafe for Base64Url
impl UnwindSafe for Base64Url
impl UnwindSafe for Base64Url