pub struct DocumentBuilder(/* private fields */);Expand description
A struct for building documents from a collection of operations.
Implementations§
Source§impl DocumentBuilder
impl DocumentBuilder
Sourcepub fn new(operations: Vec<(OperationId, Operation, PublicKey)>) -> Self
pub fn new(operations: Vec<(OperationId, Operation, PublicKey)>) -> Self
Instantiate a new DocumentBuilder from a collection of operations.
Sourcepub fn operations(&self) -> &Vec<(OperationId, Operation, PublicKey)>
pub fn operations(&self) -> &Vec<(OperationId, Operation, PublicKey)>
Get all unsorted operations for this document.
Sourcepub fn build(
&self,
) -> Result<(Document, Vec<(OperationId, Operation, PublicKey)>), DocumentBuilderError>
pub fn build( &self, ) -> Result<(Document, Vec<(OperationId, Operation, PublicKey)>), DocumentBuilderError>
Validates all contained operations and builds the document.
The returned document contains the latest resolved [document view][DocumentView].
Validation checks the following:
- There is exactly one
CREATEoperation. - All operations are causally connected to the root operation.
- All operations follow the same schema.
- No cycles exist in the graph.
Sourcepub fn build_to_view_id(
&self,
document_view_id: DocumentViewId,
) -> Result<(Document, Vec<(OperationId, Operation, PublicKey)>), DocumentBuilderError>
pub fn build_to_view_id( &self, document_view_id: DocumentViewId, ) -> Result<(Document, Vec<(OperationId, Operation, PublicKey)>), DocumentBuilderError>
Validates all contained operations and builds the document up to the
requested DocumentViewId.
The returned document contains the requested [document view][DocumentView].
Validation checks the following:
- There is exactly one
CREATEoperation. - All operations are causally connected to the root operation.
- All operations follow the same schema.
- No cycles exist in the graph.
Trait Implementations§
Source§impl Clone for DocumentBuilder
impl Clone for DocumentBuilder
Source§fn clone(&self) -> DocumentBuilder
fn clone(&self) -> DocumentBuilder
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 DocumentBuilder
impl Debug for DocumentBuilder
Source§impl<T> From<&Vec<T>> for DocumentBuilder
impl<T> From<&Vec<T>> for DocumentBuilder
Auto Trait Implementations§
impl Freeze for DocumentBuilder
impl RefUnwindSafe for DocumentBuilder
impl Send for DocumentBuilder
impl Sync for DocumentBuilder
impl Unpin for DocumentBuilder
impl UnwindSafe for DocumentBuilder
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