pub struct PackageBundle {
pub metadata: BundleMetadata,
pub modules: Vec<BundledModule>,
pub dependencies: HashMap<String, String>,
pub blob_store: HashMap<[u8; 32], Vec<u8>>,
pub manifests: Vec<ModuleManifest>,
pub native_dependency_scopes: Vec<BundledNativeDependencyScope>,
pub docs: HashMap<String, Vec<DocItem>>,
}Expand description
A compiled package bundle containing all modules and metadata.
Fields§
§metadata: BundleMetadataBundle metadata
modules: Vec<BundledModule>Compiled modules
dependencies: HashMap<String, String>Declared dependency versions (name -> version string)
blob_store: HashMap<[u8; 32], Vec<u8>>Content-addressed blob store: hash -> raw blob bytes. Blobs are deduplicated across modules so shared functions are stored once.
manifests: Vec<ModuleManifest>Module manifests for content-addressed resolution.
Each manifest maps export names to blob hashes in blob_store.
native_dependency_scopes: Vec<BundledNativeDependencyScope>Native dependency scopes for this package and all transitive dependencies.
Used by consumers of .shapec bundles to lock/validate native prerequisites.
docs: HashMap<String, Vec<DocItem>>Documentation items extracted from source code, keyed by module path.
Implementations§
Source§impl PackageBundle
impl PackageBundle
Sourcepub fn to_bytes(&self) -> Result<Vec<u8>, String>
pub fn to_bytes(&self) -> Result<Vec<u8>, String>
Serialize the bundle to bytes with magic header.
Sourcepub fn from_bytes(data: &[u8]) -> Result<Self, String>
pub fn from_bytes(data: &[u8]) -> Result<Self, String>
Deserialize a bundle from bytes, validating magic and version.
Supports v1 (no blob_store/manifests), v2, and v3 (docs) bundles.
Missing fields are filled with defaults via #[serde(default)].
Sourcepub fn read_from_file(path: &Path) -> Result<Self, String>
pub fn read_from_file(path: &Path) -> Result<Self, String>
Read a bundle from a file.
Trait Implementations§
Source§impl Clone for PackageBundle
impl Clone for PackageBundle
Source§fn clone(&self) -> PackageBundle
fn clone(&self) -> PackageBundle
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more