Skip to main content

TypedBody

Trait TypedBody 

Source
pub trait TypedBody:
    Any
    + Send
    + Debug {
    // Required methods
    fn words(&self) -> usize;
    fn serialize_into(&self, dst: &mut [u64]);
    fn as_any(&self) -> &dyn Any;
    fn into_any(self: Box<Self>) -> Box<dyn Any>;
}
Available on Unix and crate feature pool only.
Expand description

A chunk body the pool holds in its owner’s in-memory form, serializing it only when it has to leave that form: on eviction, on backing, and on a copy-out read. Under budget a typed chunk therefore costs the pool its bookkeeping and nothing else, and ChunkHandle::take_typed hands the body back without a copy.

The body is immutable once inserted. Spill threads serialize and drop it under the chunk’s state lock, so it must be Send.

Required Methods§

Source

fn words(&self) -> usize

The serialized length in u64 words. Must not change while the pool holds the body.

Source

fn serialize_into(&self, dst: &mut [u64])

Writes the serialized form into dst, which is exactly TypedBody::words long, overwriting all of it.

Source

fn as_any(&self) -> &dyn Any

The body as std::any::Any, for the owner to downcast a borrow.

Source

fn into_any(self: Box<Self>) -> Box<dyn Any>

The body as std::any::Any, for the owner to downcast a take.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§