pub trait Chunk:
Send
+ Sync
+ 'static {
type Header: ChunkHeader;
// Required methods
fn address(&self) -> &ChunkAddress;
fn header(&self) -> &Self::Header;
fn data(&self) -> &Bytes;
// Provided methods
fn size(&self) -> usize { ... }
fn verify(&self, expected: &ChunkAddress) -> Result<()> { ... }
}Expand description
Core trait for all chunk types in the system.
This trait defines the common interface that all chunk implementations must provide. Each implementation must specify its type ID and version as associated constants.
Required Associated Types§
Sourcetype Header: ChunkHeader
type Header: ChunkHeader
The header type for this chunk
Required Methods§
Sourcefn address(&self) -> &ChunkAddress
fn address(&self) -> &ChunkAddress
Get the address of this chunk
Provided Methods§
Sourcefn verify(&self, expected: &ChunkAddress) -> Result<()>
fn verify(&self, expected: &ChunkAddress) -> Result<()>
Verify that this chunk matches an expected address
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".