Module fog_pack::document[][src]

Expand description

Serialized data optionally adhering to a schema.

Documents are created by taking a serializable struct and calling NewDocument::new with it, along with an optional Hash of the schema the document will adhere to. Once created, it can be signed and the compression setting can be chosen. To create a complete, verified document, it must be passed to NoSchema or a Schema, as appropriate.

In addition to direct creation, two additional builder structs are available. VecDocumentBuilder can be used to take a long iterator and create many documents that are arrays of the serialized items in the iterator. The builder produces documents 512 kiB in size or lower. This is useful for serializing large lists that don’t fit in the Document maximum size limit of 1 MiB. AsyncVecDocumentBuilder does the same, but for asynchronous Streams.

Structs

An stream adapter for building many Documents.

Holds serialized data optionally adhering to a schema.

A new Document that has not yet been validated.

An iterator adapter for building many Documents.

Functions

Attempt to get the schema for a raw document. Fails if the raw byte slice doesn’t conform to the right format, or if the hash is invalid.