Trait abomonation::Abomonation [] [src]

pub trait Abomonation {
    unsafe fn entomb(&self, _writer: &mut Vec<u8>) { ... }
unsafe fn embalm(&mut self) { ... }
unsafe fn exhume<'a, 'b>(
        &'a mut self,
        bytes: &'b mut [u8]
    ) -> Option<&'b mut [u8]> { ... } }

Abomonation provides methods to serialize any heap data the implementor owns.

The default implementations for Abomonation's methods are all empty. Many types have no owned data to transcribe. Some do, however, and need to carefully implement these unsafe methods.

Safety

Abomonation has no safe methods. Please do not call them. They should be called only by encode and decode, each of which impose restrictions on ownership and lifetime of the data they take as input and return as output.

If you are concerned about safety, it may be best to avoid Abomonation all together. It does several things that may be undefined behavior, depending on how undefined behavior is defined.

Provided Methods

Write any additional information about &self beyond its binary representation.

Most commonly this is owned data on the other end of pointers in &self.

Perform any final edits before committing &mut self. Importantly, this method should only manipulate the fields of self; any owned memory may not be valid.

Most commonly this overwrites pointers whose values should not be serialized.

Recover any information for &mut self not evident from its binary representation.

Most commonly this populates pointers with valid references into bytes.

Implementors