Struct rscache::codec::DecodedBuffer [−][src]
pub struct DecodedBuffer {
pub compression: Compression,
pub len: usize,
pub version: Option<i16>,
// some fields omitted
}Expand description
Decodes a cache buffer with some additional data.
This struct can be useful if you need more details then just the decoded data.
Examples
TryFrom<&[u8]> -> DecodedBuffer:
use rscache::codec::DecodedBuffer;
use std::convert::TryFrom;
let buffer = cache.read(2, 10)?;
let decoded = DecodedBuffer::try_from(buffer.as_slice())?;
assert_eq!(decoded.compression, Compression::Bzip2);
assert_eq!(decoded.len, 886570);
assert_eq!(decoded.version, Some(12609));Getting the inner buffer: This conversion is free.
let buffer = cache.read(2, 10)?;
let decoded = DecodedBuffer::try_from(buffer.as_slice())?;
let inner_buffer: Vec<u8> = decoded.into_vec();Fields
compression: Compressionlen: usizeversion: Option<i16>Implementations
Trait Implementations
Returns the “default value” for a type. Read more
This method tests for self and other values to be equal, and is used
by ==. Read more
This method tests for !=.
This method returns an ordering between self and other values if one exists. Read more
This method tests less than (for self and other) and is used by the < operator. Read more
This method tests less than or equal to (for self and other) and is used by the <=
operator. Read more
This method tests greater than (for self and other) and is used by the > operator. Read more
Auto Trait Implementations
impl RefUnwindSafe for DecodedBuffer
impl Send for DecodedBuffer
impl Sync for DecodedBuffer
impl Unpin for DecodedBuffer
impl UnwindSafe for DecodedBuffer
Blanket Implementations
Mutably borrows from an owned value. Read more