[−][src]Struct serde_bytes::Bytes
Wrapper around &[u8] to serialize and deserialize efficiently.
use std::collections::HashMap;
use std::io;
use serde_bytes::Bytes;
fn print_encoded_cache() -> bincode::Result<()> {
let mut cache = HashMap::new();
cache.insert(3, Bytes::new(b"three"));
cache.insert(2, Bytes::new(b"two"));
cache.insert(1, Bytes::new(b"one"));
bincode::serialize_into(&mut io::stdout(), &cache)
}
#
# fn main() {
# print_encoded_cache().unwrap();
# }
Methods
impl<'a> Bytes<'a>[src]
Trait Implementations
impl<'a> From<&'a [u8]> for Bytes<'a>[src]
impl<'a> From<Bytes<'a>> for &'a [u8][src]
impl<'a> PartialEq<Bytes<'a>> for Bytes<'a>[src]
impl<'a> PartialOrd<Bytes<'a>> for Bytes<'a>[src]
fn partial_cmp(&self, other: &Bytes<'a>) -> Option<Ordering>[src]
fn lt(&self, other: &Bytes<'a>) -> bool[src]
fn le(&self, other: &Bytes<'a>) -> bool[src]
fn gt(&self, other: &Bytes<'a>) -> bool[src]
fn ge(&self, other: &Bytes<'a>) -> bool[src]
impl<'a> Eq for Bytes<'a>[src]
impl<'a> Copy for Bytes<'a>[src]
impl<'a> Ord for Bytes<'a>[src]
fn cmp(&self, other: &Bytes<'a>) -> Ordering[src]
fn max(self, other: Self) -> Self1.21.0[src]
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self1.21.0[src]
Compares and returns the minimum of two values. Read more
impl<'a> Clone for Bytes<'a>[src]
fn clone(&self) -> Bytes<'a>[src]
fn clone_from(&mut self, source: &Self)1.0.0[src]
Performs copy-assignment from source. Read more
impl<'a> Deref for Bytes<'a>[src]
impl<'a> Debug for Bytes<'a>[src]
impl<'a> Hash for Bytes<'a>[src]
fn hash<__H: Hasher>(&self, state: &mut __H)[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher, 1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher]. Read more
impl<'a> Serialize for Bytes<'a>[src]
impl<'de, 'a, E> IntoDeserializer<'de, E> for Bytes<'a> where
E: Error, [src]
E: Error,
type Deserializer = BytesDeserializer<'a, E>
The type of the deserializer being converted into.
fn into_deserializer(self) -> Self::Deserializer[src]
impl<'a, 'de: 'a> Deserialize<'de> for Bytes<'a>[src]
fn deserialize<D>(deserializer: D) -> Result<Bytes<'a>, D::Error> where
D: Deserializer<'de>, [src]
D: Deserializer<'de>,
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>, [src]
U: From<T>,
impl<T> From for T[src]
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
impl<T, U> TryFrom for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T> Borrow for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T, U> TryInto for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<T> DeserializeOwned for T where
T: Deserialize<'de>, [src]
T: Deserialize<'de>,