pub struct ContentAddress {
pub root_hash: [u8; 32],
pub chunk_hashes: Vec<[u8; 32]>,
pub total_size: u64,
pub chunk_count: u32,
}Expand description
Content address uniquely identifying stored content
Fields§
§root_hash: [u8; 32]BLAKE3 hash of the content manifest
chunk_hashes: Vec<[u8; 32]>Individual chunk hashes
total_size: u64Total content size in bytes
chunk_count: u32Number of chunks
Implementations§
Source§impl ContentAddress
impl ContentAddress
Sourcepub fn new(data: &[u8]) -> Self
pub fn new(data: &[u8]) -> Self
Create a new content address from data bytes (convenience method)
Sourcepub fn new_detailed(
root_hash: [u8; 32],
chunk_hashes: Vec<[u8; 32]>,
total_size: u64,
) -> Self
pub fn new_detailed( root_hash: [u8; 32], chunk_hashes: Vec<[u8; 32]>, total_size: u64, ) -> Self
Create a new content address with detailed info
Sourcepub fn from_bytes(bytes: &[u8]) -> Self
pub fn from_bytes(bytes: &[u8]) -> Self
Create a content address from bytes (using the bytes as root hash)
Trait Implementations§
Source§impl Clone for ContentAddress
impl Clone for ContentAddress
Source§fn clone(&self) -> ContentAddress
fn clone(&self) -> ContentAddress
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ContentAddress
impl Debug for ContentAddress
Source§impl<'de> Deserialize<'de> for ContentAddress
impl<'de> Deserialize<'de> for ContentAddress
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Hash for ContentAddress
impl Hash for ContentAddress
Source§impl PartialEq for ContentAddress
impl PartialEq for ContentAddress
Source§impl Serialize for ContentAddress
impl Serialize for ContentAddress
impl Eq for ContentAddress
impl StructuralPartialEq for ContentAddress
Auto Trait Implementations§
impl Freeze for ContentAddress
impl RefUnwindSafe for ContentAddress
impl Send for ContentAddress
impl Sync for ContentAddress
impl Unpin for ContentAddress
impl UnwindSafe for ContentAddress
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.