Trait flatdata::Archive[][src]

pub trait Archive: Debug + Clone {
    const NAME: &'static str;
    const SCHEMA: &'static str;

    fn open(
        storage: Rc<RefCell<ResourceStorage>>
    ) -> Result<Self, ResourceStorageError>; }

A flatdata archive representing serialized data.

Each archive in generated code implements this trait.

Associated Constants

Name of the archive.

Schema of the archive.

Used for verifying the integrity of the archive when opening.

Required Methods

Opens the archive with name NAME and schema SCHEMA in the given storage for reading.

When opening the archive, the schema of the archive and the schema stored in the storage are compared as strings. If there is a difference, an Error [ResourceStorageError::WrongSignature](enum. ResourceStorageError.html) is returned containing a detailed diff of both schemata.

All resources are in the archive are also opened and their schemata are verified. If any non-optional resource is missing or has a wrong signature (unexpected schema), the operation will fail. Therefore, it is not possible to open partially written archive.

Implementors