pub trait DataChunkwhere
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§
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>
Sourcefn into_bytes(self) -> Bytes
fn into_bytes(self) -> Bytes
Sourcefn into_owned(self) -> OwnedDataChunk
fn into_owned(self) -> OwnedDataChunk
Copies this DataChunk
into a new OwnedDataChunk
.
fn try_as<T: Archive>(self) -> Result<TypedDataChunk<Self, T>>
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.