pub struct SubtreeData {
pub root_id: [u8; 32],
pub root_hash: [u8; 32],
pub entities: Vec<TreeLeafData>,
pub depth: usize,
pub truncated: bool,
}Expand description
Data for a single subtree.
Contains all entities within the subtree for bulk CRDT merge.
Fields§
§root_id: [u8; 32]Root ID of this subtree.
root_hash: [u8; 32]Root hash of this subtree (for verification).
entities: Vec<TreeLeafData>All entities in this subtree (leaves only). Includes full data and metadata for CRDT merge.
Limited to MAX_ENTITIES_PER_SUBTREE entries. Use is_valid() to check
bounds after deserialization from untrusted sources.
depth: usizeDepth of this subtree (how many levels were traversed).
truncated: boolWhether the subtree was truncated due to depth limit.
Implementations§
Source§impl SubtreeData
impl SubtreeData
Sourcepub fn new(
root_id: [u8; 32],
root_hash: [u8; 32],
entities: Vec<TreeLeafData>,
depth: usize,
) -> Self
pub fn new( root_id: [u8; 32], root_hash: [u8; 32], entities: Vec<TreeLeafData>, depth: usize, ) -> Self
Create subtree data.
Sourcepub fn truncated(
root_id: [u8; 32],
root_hash: [u8; 32],
entities: Vec<TreeLeafData>,
depth: usize,
) -> Self
pub fn truncated( root_id: [u8; 32], root_hash: [u8; 32], entities: Vec<TreeLeafData>, depth: usize, ) -> Self
Create truncated subtree data (depth limit reached).
Sourcepub fn entity_count(&self) -> usize
pub fn entity_count(&self) -> usize
Number of entities in this subtree.
Sourcepub fn is_truncated(&self) -> bool
pub fn is_truncated(&self) -> bool
Check if more data exists beyond depth limit.
Trait Implementations§
Source§impl BorshDeserialize for SubtreeData
impl BorshDeserialize for SubtreeData
fn deserialize_reader<__R: Read>(reader: &mut __R) -> Result<Self, Error>
Source§fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
Deserializes this instance from a given slice of bytes.
Updates the buffer to point at the remaining bytes.
Source§fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_slice(v: &[u8]) -> Result<Self, Error>
Deserialize this instance from a slice of bytes.
fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>where
R: Read,
Source§impl BorshSerialize for SubtreeData
impl BorshSerialize for SubtreeData
Source§impl Clone for SubtreeData
impl Clone for SubtreeData
Source§fn clone(&self) -> SubtreeData
fn clone(&self) -> SubtreeData
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 SubtreeData
impl Debug for SubtreeData
Source§impl PartialEq for SubtreeData
impl PartialEq for SubtreeData
impl StructuralPartialEq for SubtreeData
Auto Trait Implementations§
impl Freeze for SubtreeData
impl RefUnwindSafe for SubtreeData
impl Send for SubtreeData
impl Sync for SubtreeData
impl Unpin for SubtreeData
impl UnsafeUnpin for SubtreeData
impl UnwindSafe for SubtreeData
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<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more