Skip to main content

PagableSerializer

Trait PagableSerializer 

Source
pub trait PagableSerializer {
    // Required methods
    fn serde(&mut self) -> &mut Serializer<PagableVecFlavor>;
    fn serialize_arc(&mut self, arc: &dyn ArcEraseDyn) -> Result<()>;
    fn position(&mut self) -> PagableCursor;
    fn session_context(&mut self) -> &SessionContext;

    // Provided method
    unsafe fn write_at(&mut self, pos: usize, bytes: &[u8]) { ... }
}
Expand description

Trait for serializers that support pagable serialization.

Implementors provide access to an underlying serde serializer and the ability to preserve arc instance equality across serialization.

Required Methods§

Source

fn serde(&mut self) -> &mut Serializer<PagableVecFlavor>

Get a mutable reference to the underlying postcard serializer.

Source

fn serialize_arc(&mut self, arc: &dyn ArcEraseDyn) -> Result<()>

Serialize an Arc, preserving its identity for deduplication.

Implementations should track Arc identity so that the same Arc serialized multiple times results in shared references after deserialization.

Source

fn position(&mut self) -> PagableCursor

Current cursor position (byte position + arc index).

Source

fn session_context(&mut self) -> &SessionContext

Access the session context for storing/retrieving layer-specific state.

Provided Methods§

Source

unsafe fn write_at(&mut self, pos: usize, bytes: &[u8])

Overwrite bytes at a previously written position.

§Safety

Caller must ensure pos + bytes.len() does not exceed the current byte position, and that the overwritten region is semantically valid for the format.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§