Skip to main content

MergedRecord

Enum MergedRecord 

Source
pub enum MergedRecord {
    Entry {
        id: EntryId,
        entry: Box<Entry>,
    },
    Tombstone(Box<Tombstone>),
    Group {
        id: GroupId,
        group: Box<Group>,
    },
}
Expand description

A record received from a peer, together with its identifier.

The identifier lives here rather than in VaultEntry because VaultEntry deliberately carries no ID: an entry that brought its own identifier would allow two contradictory identifiers within the same data. Every record in a sync payload must carry its identifier — it is one of the AEAD associated data items and the key of the union. Sealing the pair in an enum makes the state “there is an entry but its identity is unknown” unrepresentable, so merge_into needs no Result to report a self-contradictory record.

§No Clone

VaultEntry deliberately does not implement Clone (see crate::otp::OtpSecret), so this enum cannot derive it either. Copying goes through VaultEntry::duplicate, an explicit entry point: the call site has to spell out duplicate(), which makes “another copy of key material is made here” visible in review.

Variants§

§

Entry

A live entry.

Fields

§id: EntryId

The identifier of the entry.

§entry: Box<Entry>

The content of the entry.

§

Tombstone(Box<Tombstone>)

A tombstone (deletion record).

§

Group

A group with its ordering.

The granularity is the whole group: its name, its position and the order of its entries travel as one value, because that is what the user arranged and what the adjudication screen shows side by side.

Fields

§id: GroupId

The identifier of the group.

§group: Box<Group>

The group itself.

Implementations§

Source§

impl MergedRecord

Source

pub fn entry_id(&self) -> EntryId

The 16-byte key this record is filed under.

For a group that is its identifier reinterpreted, since the payload keys its records by 16 opaque bytes and does not distinguish the kinds (see RecordSet).

Trait Implementations§

Source§

impl Debug for MergedRecord

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for MergedRecord

Source§

impl HasEntryId for MergedRecord

Source§

fn entry_id(&self) -> EntryId

Which entry this record is about.
Source§

impl PartialEq for MergedRecord

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for MergedRecord

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.