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
pub fn new(peer: PeerID, counter: Counter) -> Self
Sourcepub const fn delete_root() -> Self
pub const fn delete_root() -> Self
return DELETED_TREE_ROOT
Sourcepub fn is_deleted_root(&self) -> bool
pub fn is_deleted_root(&self) -> bool
return true
if the TreeID
is deleted 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 PartialOrd for TreeID
impl PartialOrd for TreeID
impl Copy for TreeID
impl Eq for TreeID
impl StructuralPartialEq for TreeID
Auto Trait Implementations§
impl Freeze for TreeID
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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