NewEntry

Struct NewEntry 

Source
pub struct NewEntry(/* private fields */);
Expand description

A new Entry that has not yet been validated.

This struct acts like an Entry, but cannot be decoded until it has passed through a Schema.

Implementations§

Source§

impl NewEntry

Source

pub fn new<S: Serialize>(key: &str, parent: &Document, data: S) -> Result<Self>

Create a new Entry from any serializable data, a key, and the Hash of the parent document.

Source

pub fn new_ordered<S: Serialize>( data: S, key: &str, parent: &Document, ) -> Result<Self>

Create a new Entry from a key, the Hash of the parent document, and any serializable data whose keys are all ordered. For structs, this means all fields are declared in lexicographic order. For maps, this means a BTreeMap type must be used, whose keys are ordered such that they serialize to lexicographically ordered strings. All sub-structs and sub-maps must be similarly ordered.

Source

pub fn compression(self, setting: Option<u8>) -> Self

Override the default compression settings. None will disable compression. Some(level) will compress with the provided level as the setting for the algorithm.

Source

pub fn sign(self, key: &IdentityKey) -> Result<Self>

Sign the document, or or replace the existing signature if one exists already. Fails if the signature would grow the document size beyond the maximum allowed.

Source

pub fn hash(&self) -> &Hash

Get what the document’s hash will be, given its current state

Source

pub fn parent(&self) -> &Hash

Get the hash of the Entry’s parent Document.

Source

pub fn schema_hash(&self) -> &Hash

Get the hash of the Schema of the Entry’s parent Document.

Source

pub fn key(&self) -> &str

Get the Entry’s string key.

Source

pub fn reference(&self) -> &EntryRef

Get a EntryRef containing a full reference to the entry.

Trait Implementations§

Source§

impl Clone for NewEntry

Source§

fn clone(&self) -> NewEntry

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for NewEntry

Source§

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

Formats the value using the given formatter. Read more

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<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.