Trait DataChunk

Source
pub trait DataChunk
where Self: Sized,
{ // Required methods fn data_ref(&self) -> &[u8] ; fn hash_ref(&self) -> &Hash; fn hash(&self) -> Arc<Hash>; // Provided methods fn encrypt(&self) -> Result<EncryptedDataChunk> { ... } fn decrypt(&self, key: &[u8]) -> Result<SerializedDataChunk> { ... } fn borrow(&self) -> BorrowedDataChunk<'_> { ... } fn serialize(&self) -> Result<SerializedDataChunk> { ... } fn into_bytes(self) -> Bytes { ... } fn into_owned(self) -> OwnedDataChunk { ... } fn try_as<T: Archive>(self) -> Result<TypedDataChunk<Self, T>> where T::Archived: for<'a> CheckBytes<HighValidator<'a, Error>> { ... } }
Expand description

represents any representation of a chunk of data

Required Methods§

Source

fn data_ref(&self) -> &[u8]

Source

fn hash_ref(&self) -> &Hash

Source

fn hash(&self) -> Arc<Hash>

Provided Methods§

Source

fn encrypt(&self) -> Result<EncryptedDataChunk>

Source

fn decrypt(&self, key: &[u8]) -> Result<SerializedDataChunk>

Source

fn borrow(&self) -> BorrowedDataChunk<'_>

Source

fn serialize(&self) -> Result<SerializedDataChunk>

Source

fn into_bytes(self) -> Bytes

Transforms this DataChunk into Bytes.

Source

fn into_owned(self) -> OwnedDataChunk

Copies this DataChunk into a new OwnedDataChunk.

Source

fn try_as<T: Archive>(self) -> Result<TypedDataChunk<Self, T>>
where T::Archived: for<'a> CheckBytes<HighValidator<'a, Error>>,

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§