Trait abomonation::Abomonation
source · pub trait Abomonation {
// Provided methods
unsafe fn entomb<W: Write>(&self, _write: &mut W) -> IOResult<()> { ... }
unsafe fn exhume<'a, 'b>(
&'a mut self,
bytes: &'b mut [u8],
) -> Option<&'b mut [u8]> { ... }
fn extent(&self) -> usize { ... }
}
Expand description
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§
sourceunsafe fn entomb<W: Write>(&self, _write: &mut W) -> IOResult<()>
unsafe fn entomb<W: Write>(&self, _write: &mut W) -> IOResult<()>
Write any additional information about &self
beyond its binary representation.
Most commonly this is owned data on the other end of pointers in &self
. The return value
reports any failures in writing to write
.