[−][src]Struct fog_pack::Document
A single, immutable fog-pack object that can be signed, hashed, and compressed.
Implementations
impl Document[src]
pub fn new(v: Value) -> Result<Document, ()>[src]
Create a new document from a given Value. Fails if value isn't an Object, if the value has an empty string ("") field that doesn't contain a hash, or if the encoded value is greater than the maximum allowed document size.
pub fn sign(&mut self, vault: &Vault, key: &Key) -> Result<(), CryptoError>[src]
Sign the document with a given Key from a given Vault. Fails if the key is invalid
(BadKey), or can't be found (NotInStorage). Also fails if the resulting document is
larger than the maximum allowed document size.
pub fn set_compression(&mut self, compression: Option<i32>)[src]
Specifically set compression, overriding default schema settings. If None, no compression
will be used. If some i32, the value will be passed to the zstd compressor. Note: if the
document has no schema settings, it defaults to generic compression with default zstd
settings. This also clears out any cached compression data.
pub fn reset_compression(&mut self)[src]
Remove any overrides on the compression settings set by set_compression, and clears any
cached compression data.
pub fn clear_compress_cache(&mut self)[src]
Clear out any cached compression data. If the Document was decoded and had been compressed,
the compressed version is cached on load in case this is to be re-encoded. This can be
called to clear out the cached compressed version - it will also be cleared if either
set_compression or reset_compression is called.
pub fn signed_by(&self) -> Iter<Identity>[src]
Get an iterator over all known signers of the document.
pub fn len(&self) -> usize[src]
Get the length of the raw document, prior to encoding.
pub fn hash(&self) -> &Hash[src]
Get the Hash of the document as it currently is. Note that adding additional signatures will change the Hash.
pub fn schema_hash(&self) -> &Option<Hash>[src]
Get the Hash of the schema used by the document, if it exists.
pub fn compression(&self) -> Option<i32>[src]
Returns the compression setting that will be used if the compression is overridden. Check
override status with override_compression.
pub fn override_compression(&self) -> bool[src]
Returns true if compression is being overridden. If true, the setting returned by
compression will be used.
pub fn validated(&self) -> bool[src]
Returns true if the document has previously been validated by a schema or the general fog-pack validator. This is always true on Documents that were decoded from raw byte slices.
pub fn value(&self) -> ValueRef[src]
Retrieve the value stored inside the document as a ValueRef. This value has the same
lifetime as the Document; it can be converted to a Value if it needs to outlast the
Document.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Document
impl Send for Document
impl Sync for Document
impl Unpin for Document
impl UnwindSafe for Document
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T[src]
fn clone_into(&self, target: &mut T)[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,