Struct fog_pack::schema::NoSchema[][src]

pub struct NoSchema;

Validation for documents without a schema.

Not all documents adhere to a schema, but they must still be verified for correctness and be optionally compressed on encoding. This NoSchema struct acts like a Schema to accomplish this.

As schemaless documents cannot have attached entries, NoSchema does not do any entry encode/decode.

Implementations

impl NoSchema[src]

pub fn validate_new_doc(doc: NewDocument) -> Result<Document>[src]

Encode a NewDocument, returning the resulting Document’s hash and fully encoded format. Fails if the internal data isn’t actually valid fog-pack, which can sometimes happen with a bad Serialize implementation for the data.

pub fn encode_doc(doc: Document) -> Result<(Hash, Vec<u8>)>[src]

Re-encode a validated Document, returning the resulting Document’s hash and fully encoded format.

pub fn decode_doc(doc: Vec<u8>) -> Result<Document>[src]

Decode a document that doesn’t have a schema.

pub fn trusted_decode_doc(doc: Vec<u8>) -> Result<Document>[src]

Decode a Document, skipping any checks of the data. This should only be run when the raw document has definitely been passed through validation before, i.e. if it is stored in a local database after going through encode_doc.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,