[][src]Trait flatdata::Archive

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

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

A flatdata archive representing serialized data.

Each archive in generated code implements this trait.

Associated Constants

const NAME: &'static str

Name of the archive.

const SCHEMA: &'static str

Schema of the archive.

Used for verifying the integrity of the archive when opening.

Loading content...

Required methods

fn open(storage: Rc<dyn ResourceStorage>) -> Result<Self, ResourceStorageError>

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.

Loading content...

Implementors

Loading content...