pub struct Packer { /* private fields */ }Expand description
Binary packer for creating self-contained executables.
Implementations§
Source§impl Packer
impl Packer
Sourcepub fn new(manifest: PackManifest) -> Self
pub fn new(manifest: PackManifest) -> Self
Create a new packer with the given manifest.
Sourcepub fn with_stub(self, stub_path: impl AsRef<Path>) -> Self
pub fn with_stub(self, stub_path: impl AsRef<Path>) -> Self
Set the path to the stub executable.
Sourcepub fn with_assets(self, collector: AssetCollector) -> Self
pub fn with_assets(self, collector: AssetCollector) -> Self
Set the asset collector and update manifest with its inventory.
Sourcepub fn with_asset_collector(self, collector: AssetCollector) -> Self
pub fn with_asset_collector(self, collector: AssetCollector) -> Self
Set the asset collector without updating the manifest.
Use this when the manifest already has the correct asset inventory (e.g., when it was set from a different collector that was consumed).
Sourcepub fn manifest_mut(&mut self) -> &mut PackManifest
pub fn manifest_mut(&mut self) -> &mut PackManifest
Get a mutable reference to the manifest.
Sourcepub fn pack(self, output: impl AsRef<Path>) -> Result<PackedInfo>
pub fn pack(self, output: impl AsRef<Path>) -> Result<PackedInfo>
Pack everything into the output file using sidecar format.
Creates two files:
output- Stub executable (pure Mach-O, signable)output.smolmachine- Compressed assets + manifest + footer
This keeps the binary as a pure Mach-O executable that can be properly code-signed on macOS.
Sourcepub fn pack_embedded(self, output: impl AsRef<Path>) -> Result<PackedInfo>
pub fn pack_embedded(self, output: impl AsRef<Path>) -> Result<PackedInfo>
Pack everything into a single executable file (embedded format).
On macOS, this uses Mach-O section manipulation to embed assets inside
the __SMOLVM,__smolvm section, allowing proper code signing.
On other platforms, this appends assets to the binary (simpler but not signable on macOS).