Struct loro_common::TreeID
source · pub struct TreeID {
pub peer: PeerID,
pub counter: Counter,
}
Expand description
Each node of movable tree has a unique TreeID
generated by Loro.
To further represent the metadata (a MapContainer) associated with each node,
we also use TreeID
as ID
portion of ContainerID
.
This not only allows for convenient association of metadata with each node,
but also ensures the uniqueness of the MapContainer.
Special ID:
DELETED_TREE_ROOT
: the root of all deleted nodes. To get it byTreeID::delete_root()
Fields§
§peer: PeerID
§counter: Counter
Implementations§
source§impl TreeID
impl TreeID
sourcepub const fn delete_root() -> Option<Self>
pub const fn delete_root() -> Option<Self>
return DELETED_TREE_ROOT
sourcepub fn is_deleted_root(target: Option<TreeID>) -> bool
pub fn is_deleted_root(target: Option<TreeID>) -> bool
return true
if the TreeID
is deleted root
pub const fn unexist_root() -> Option<Self>
sourcepub fn is_unexist_root(target: Option<TreeID>) -> bool
pub fn is_unexist_root(target: Option<TreeID>) -> bool
return true
if the TreeID
is non-existent root
pub fn from_id(id: ID) -> Self
pub fn id(&self) -> ID
pub fn associated_meta_container(&self) -> ContainerID
Trait Implementations§
source§impl<'de> Deserialize<'de> for TreeID
impl<'de> Deserialize<'de> for TreeID
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 Ord for TreeID
impl Ord for TreeID
source§impl PartialEq for TreeID
impl PartialEq for TreeID
source§impl PartialOrd for TreeID
impl PartialOrd for TreeID
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Copy for TreeID
impl Eq for TreeID
impl StructuralEq for TreeID
impl StructuralPartialEq for TreeID
Auto Trait Implementations§
impl RefUnwindSafe for TreeID
impl Send for TreeID
impl Sync for TreeID
impl Unpin for TreeID
impl UnwindSafe for TreeID
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