pub struct Lineage {
pub parent: Option<DocumentId>,
pub ancestors: Vec<DocumentId>,
pub version: Option<u32>,
pub depth: Option<u32>,
pub branch: Option<String>,
pub merged_from: Vec<DocumentId>,
pub note: Option<String>,
}Expand description
Version history and document relationships.
Fields§
§parent: Option<DocumentId>Document ID of parent version.
ancestors: Vec<DocumentId>Up to 10 levels of ancestors for efficient chain verification. Ordered from nearest (parent’s parent) to furthest ancestor.
version: Option<u32>Sequential version number.
depth: Option<u32>Distance from the root document (0 for root, 1 for first child, etc.).
branch: Option<String>Branch identifier.
merged_from: Vec<DocumentId>Document IDs of documents merged into this version.
note: Option<String>Description of changes.
Implementations§
Source§impl Lineage
impl Lineage
Sourcepub fn from_parent(
parent_id: DocumentId,
parent_lineage: Option<&Lineage>,
) -> Self
pub fn from_parent( parent_id: DocumentId, parent_lineage: Option<&Lineage>, ) -> Self
Create lineage that derives from a parent document.
This automatically computes the ancestor chain (up to 10 levels) and increments the depth.
Sourcepub fn with_note(self, note: impl Into<String>) -> Self
pub fn with_note(self, note: impl Into<String>) -> Self
Add a note describing the changes in this version.
Sourcepub fn with_branch(self, branch: impl Into<String>) -> Self
pub fn with_branch(self, branch: impl Into<String>) -> Self
Set the branch name.
Sourcepub fn with_merge(self, merged_id: DocumentId) -> Self
pub fn with_merge(self, merged_id: DocumentId) -> Self
Record that this version was created by merging another document.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Lineage
impl<'de> Deserialize<'de> for Lineage
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 Eq for Lineage
impl StructuralPartialEq for Lineage
Auto Trait Implementations§
impl Freeze for Lineage
impl RefUnwindSafe for Lineage
impl Send for Lineage
impl Sync for Lineage
impl Unpin for Lineage
impl UnsafeUnpin for Lineage
impl UnwindSafe for Lineage
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.