pub struct TreeNode<T> {
pub id: NodeId,
pub value: T,
pub metadata: NodeMetadata,
pub parent: Option<NodeId>,
pub children: Vec<NodeId>,
}
Expand description
A tree node with its metadata and relationships
Fields§
§id: NodeId
Unique identifier
value: T
The actual value
metadata: NodeMetadata
Metadata
parent: Option<NodeId>
Parent node ID (None for root)
children: Vec<NodeId>
Child node IDs
Implementations§
Source§impl<T> TreeNode<T>
impl<T> TreeNode<T>
Sourcepub fn new_child(
value: T,
replica: ReplicaId,
timestamp: u64,
parent: NodeId,
) -> Self
pub fn new_child( value: T, replica: ReplicaId, timestamp: u64, parent: NodeId, ) -> Self
Create a child node
Sourcepub fn mark_modified(&mut self, replica: ReplicaId, timestamp: u64)
pub fn mark_modified(&mut self, replica: ReplicaId, timestamp: u64)
Mark as modified
Sourcepub fn mark_deleted(&mut self, replica: ReplicaId, timestamp: u64)
pub fn mark_deleted(&mut self, replica: ReplicaId, timestamp: u64)
Mark as deleted
Sourcepub fn remove_child(&mut self, child_id: &NodeId) -> bool
pub fn remove_child(&mut self, child_id: &NodeId) -> bool
Remove a child
Trait Implementations§
Source§impl<'de, T> Deserialize<'de> for TreeNode<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for TreeNode<T>where
T: Deserialize<'de>,
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
impl<T: Eq> Eq for TreeNode<T>
impl<T> StructuralPartialEq for TreeNode<T>
Auto Trait Implementations§
impl<T> Freeze for TreeNode<T>where
T: Freeze,
impl<T> RefUnwindSafe for TreeNode<T>where
T: RefUnwindSafe,
impl<T> Send for TreeNode<T>where
T: Send,
impl<T> Sync for TreeNode<T>where
T: Sync,
impl<T> Unpin for TreeNode<T>where
T: Unpin,
impl<T> UnwindSafe for TreeNode<T>where
T: UnwindSafe,
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§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.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> FromFormData for Twhere
T: DeserializeOwned,
impl<T> FromFormData for Twhere
T: DeserializeOwned,
Source§fn from_event(ev: &Event) -> Result<T, FromFormDataError>
fn from_event(ev: &Event) -> Result<T, FromFormDataError>
Tries to deserialize the data, given only the
submit
event.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 moreSource§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> SerializableKey for T
impl<T> SerializableKey for T
Source§impl<T> StorageAccess<T> for T
impl<T> StorageAccess<T> for T
Source§fn as_borrowed(&self) -> &T
fn as_borrowed(&self) -> &T
Borrows the value.
Source§fn into_taken(self) -> T
fn into_taken(self) -> T
Takes the value.