pub struct Document(/* private fields */);
Expand description
Holds serialized data optionally adhering to a schema.
A Document holds a piece of serialized data, which may be deserialized by calling
deserialize
. If it adheres to a schema, Entries may also be attached
to it, in accordance with the schema.
Implementations§
Source§impl Document
impl Document
Sourcepub fn find_hashes(&self) -> Vec<Hash>
pub fn find_hashes(&self) -> Vec<Hash>
Find all hashes in this document and return them.
Sourcepub fn schema_hash(&self) -> Option<&Hash>
pub fn schema_hash(&self) -> Option<&Hash>
Get the hash of the schema this document adheres to.
Sourcepub fn signer(&self) -> Option<&Identity>
pub fn signer(&self) -> Option<&Identity>
Get the Identity of the signer of this document, if the document is signed.
Sourcepub fn hash(&self) -> &Hash
pub fn hash(&self) -> &Hash
Get the hash of the complete document. This can change if the document is signed again with
the sign
function.
Sourcepub fn deserialize<'de, D: Deserialize<'de>>(&'de self) -> Result<D>
pub fn deserialize<'de, D: Deserialize<'de>>(&'de self) -> Result<D>
Attempt to deserialize the data into anything implementing Deserialize
.
Sourcepub fn compression(self, setting: Option<u8>) -> Self
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. This only has
meaning when the document is re-encoded.
Sourcepub fn sign(self, key: &IdentityKey) -> Result<Self>
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.