serde: Add Base64::into_inner

This commit is contained in:
Jonas Platte 2022-01-23 12:01:45 +01:00
parent a39bee9949
commit 47cc004e06
No known key found for this signature in database
GPG Key ID: 7D261D771D915378

View File

@ -18,7 +18,7 @@ impl<B: AsRef<[u8]>> Base64<B> {
Self { bytes }
}
/// Get the raw bytes held by this `Base64` instance.
/// Get a reference to the raw bytes held by this `Base64` instance.
pub fn as_bytes(&self) -> &[u8] {
self.bytes.as_ref()
}
@ -29,6 +29,13 @@ impl<B: AsRef<[u8]>> Base64<B> {
}
}
impl<B> Base64<B> {
/// Get the raw bytes held by this `Base64` instance.
pub fn into_inner(self) -> B {
self.bytes
}
}
impl Base64 {
/// Create a `Base64` instance containing an empty `Vec<u8>`.
pub fn empty() -> Self {