Skip to main content

Packer

Struct Packer 

Source
pub struct Packer { /* private fields */ }
Expand description

Binary packer for creating self-contained executables.

Implementations§

Source§

impl Packer

Source

pub fn new(manifest: PackManifest) -> Self

Create a new packer with the given manifest.

Source

pub fn with_stub(self, stub_path: impl AsRef<Path>) -> Self

Set the path to the stub executable.

Source

pub fn with_assets(self, collector: AssetCollector) -> Self

Set the asset collector and update manifest with its inventory.

Source

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).

Source

pub fn manifest_mut(&mut self) -> &mut PackManifest

Get a mutable reference to the manifest.

Source

pub fn pack(self, output: impl AsRef<Path>) -> Result<PackedInfo>

Pack everything into the output file using sidecar format.

Creates two files:

  1. output - Stub executable (pure Mach-O, signable)
  2. output.smolmachine - Compressed assets + manifest + footer

This keeps the binary as a pure Mach-O executable that can be properly code-signed on macOS.

Source

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).

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.