pub struct PinnedRelation(/* private fields */);Expand description
Reference to the exact version of the document.
PinnedRelation pin a relation to a specific, immutable version of a document or many
documents when necessary (PinnedRelation or PinnedRelationList).
When the blog post from the Relation example changes its contents from Monday evening to
Tuesday morning the comment would automatically refer to the new version as the comment
refers to the document as a whole, including all future changes.
Since the comment was probably meant to be referring to Monday when it was created, we have to
pin it to the exact version of the blog post in order to preserve this meaning. A
PinnedRelation achieves this by referring to the blog post’s document view id:
Document-View Document-View
| |
Document: [Blog-Post "Monday evening"] -- UPDATE -- > [Blog-Post "Tuesday morning"]
^
|
_____________| Pinned Relation (we will stay in the "past")
|
|
Document: [Comment "This was great!"]Document view ids contain the operation ids of the document graph tips, which is all the information we need to reliably recreate the document at this certain point in time.
Pinned relations give us immutability and the option to restore a historical state across documents. However, most cases will probably only need unpinned relations: For example when referring to a user-profile you probably want to always get the latest version.
Implementations§
Source§impl PinnedRelation
impl PinnedRelation
Sourcepub fn new(document_view_id: DocumentViewId) -> Self
pub fn new(document_view_id: DocumentViewId) -> Self
Returns a new pinned relation field.
Sourcepub fn view_id(&self) -> &DocumentViewId
pub fn view_id(&self) -> &DocumentViewId
Returns the pinned relation’s document view id.
Sourcepub fn iter(&self) -> Iter<'_, OperationId>
pub fn iter(&self) -> Iter<'_, OperationId>
Returns iterator over operation ids.
Trait Implementations§
Source§impl Clone for PinnedRelation
impl Clone for PinnedRelation
Source§fn clone(&self) -> PinnedRelation
fn clone(&self) -> PinnedRelation
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PinnedRelation
impl Debug for PinnedRelation
Source§impl<'de> Deserialize<'de> for PinnedRelation
impl<'de> Deserialize<'de> for PinnedRelation
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>,
Source§impl PartialEq for PinnedRelation
impl PartialEq for PinnedRelation
Source§impl Serialize for PinnedRelation
impl Serialize for PinnedRelation
Source§impl Validate for PinnedRelation
impl Validate for PinnedRelation
impl Eq for PinnedRelation
impl StructuralPartialEq for PinnedRelation
Auto Trait Implementations§
impl Freeze for PinnedRelation
impl RefUnwindSafe for PinnedRelation
impl Send for PinnedRelation
impl Sync for PinnedRelation
impl Unpin for PinnedRelation
impl UnwindSafe for PinnedRelation
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
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>
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>
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