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>,
}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.
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 both v1 (no blob_store/manifests) and v2 bundles. The v1
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 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PackageBundle
impl Debug for PackageBundle
Source§impl<'de> Deserialize<'de> for PackageBundle
impl<'de> Deserialize<'de> for PackageBundle
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for PackageBundle
impl RefUnwindSafe for PackageBundle
impl Send for PackageBundle
impl Sync for PackageBundle
impl Unpin for PackageBundle
impl UnsafeUnpin for PackageBundle
impl UnwindSafe for PackageBundle
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more