Struct membuffer::Position [−][src]
!This crate will provide a extremely fast deserialization of dynamic data structures with big fields. This is very MMAP friendly since it only parses the header and does not parse the fields until requested. Easy example:
use membuffer::{MemBufferWriter,MemBufferReader}; fn main() { //Creates a new empty MemBufferWriter let mut writer = MemBufferWriter::new(); //Adds this as immutable field, no more changing after adding it //The first entry is the key and must be a type that implements Into<i32> writer.add_entry("Very long value"); //Creates a Vec<u8> out of all the collected data let result = writer.finalize(); //Try to read the created vector. Will return an error if the CRC32 does not fit //or if the header is not terminated. Will panic if the memory is corrupted beyond recognition let reader = MemBufferReader::new(&result).unwrap(); //Will return an error if the selected key could not be found or if the value types dont match assert_eq!(reader.load_entry::<&str>(0).unwrap(), "Very long value"); }
Refers to a position given to every deserialize and serialize operation, can be used to store data if one does not need to store data in the payload e. g. Field smaller than 8 Bytes
Fields
offset: i32
length: i32
Auto Trait Implementations
impl RefUnwindSafe for Position
[src]
impl Send for Position
[src]
impl Sync for Position
[src]
impl Unpin for Position
[src]
impl UnwindSafe for Position
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,