web-static-pack-common 0.5.2

Common types for web-static-pack and web-static-pack-packer crates.
Documentation
//! Pack is the root entity, a collection of files.

use crate::{file::File, pack_path::PackPath};
use rkyv::{Archive, Serialize};
use std::collections::HashMap;

/// Pack represents a group of files distinguished by their path.
///
/// [Pack] is a bit like a `zip`, single entity containing directory/file tree.
/// [Pack] will usually be built with
/// [web-static-pack-packer](https://crates.io/crates/web-static-pack-packer)
/// crate, either with command line tool or by a script/build.rs. After [Pack]
/// is built, it will be serialized (called "Archived" by [rkyv] we use for that
/// purpose) into zero-copy deserializable representation - [PackArchived]. This
/// representation will be then included by your target program into binary (or
/// read/mmaped from fs) and served with
/// [web-static-pack](https://crates.io/crates/web-static-pack)
/// crate.
#[derive(Archive, Serialize, Debug)]
#[rkyv(archived = PackArchived)]
#[rkyv(derive(Debug))]
#[rkyv(attr(allow(missing_docs)))] // TODO: resolve with https://github.com/rkyv/rkyv/issues/561
pub struct Pack {
    /// List of contained files by their paths.
    pub files_by_path: HashMap<PackPath, File>,
}