Struct membuffer::MemBufferWriter [−][src]
The Writer class which sets up the schema and writes it into the memory when finished building
Implementations
impl MemBufferWriter
[src]
pub fn new() -> MemBufferWriter
[src]
Creates a new empty memory format writer
pub fn from<'a>(raw_memory: &'a [u8]) -> Result<MemBufferWriter, MemBufferError>
[src]
Create a new Membuffer writer from the given memory, this will enable the writer to add more data to the previous version, to do so the writer does a full reload of the memory therefore it is an expensive operation if the structure adding fields to is huge.
use membuffer::{MemBufferWriter,MemBufferReader}; let mut value = MemBufferWriter::new(); value.add_entry("Hello"); value.add_entry("World"); let data = value.finalize(); let mut writer_adder = MemBufferWriter::from(&data).unwrap(); writer_adder.add_entry("Damn I forgot"); let new_data = writer_adder.finalize();
pub fn serialize_i32_to(val: i32, to: &mut Vec<u8>)
[src]
Serializes the integer to the memory slice
pub fn add_entry<T: MemBufferSerialize>(&mut self, val: T)
[src]
Adds an entry to the writer the only requirement is the serializable trait
pub fn add_serde_entry<T: Serialize>(&mut self, val: &T)
[src]
Adds a serde serializable entry into the structure as serializer serde_json is used. Internally it is saved as a string.
pub fn finalize(&self) -> Vec<u8>
[src]
Finalize the schema and return the memory slice holding the whole vector
Trait Implementations
impl MemBufferSerialize for MemBufferWriter
[src]
fn to_mem_buffer<'a>(&'a self, _: &mut Position) -> Cow<'a, [u8]>
[src]
fn get_mem_buffer_type() -> i32
[src]
Auto Trait Implementations
impl RefUnwindSafe for MemBufferWriter
[src]
impl Send for MemBufferWriter
[src]
impl Sync for MemBufferWriter
[src]
impl Unpin for MemBufferWriter
[src]
impl UnwindSafe for MemBufferWriter
[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>,