Skip to main content

BundleBuilder

Struct BundleBuilder 

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

Builds a .pkg bundle file.

Implementations§

Source§

impl BundleBuilder

Source

pub fn new() -> Self

Source

pub fn add_section(&mut self, kind: SectionKind, path: String, data: Vec<u8>)

Source

pub fn add_manifest(&mut self, manifest: &Manifest) -> Result<()>

Source

pub fn add_crate_file(&mut self, name: &str, version: &str, data: Vec<u8>)

Source

pub fn add_index_entry(&mut self, name: &str, data: Vec<u8>)

Source

pub fn add_rustup_file(&mut self, target: &str, filename: &str, data: Vec<u8>)

Source

pub fn add_dist_file(&mut self, relative_path: &str, data: Vec<u8>)

Source

pub fn add_config(&mut self, config_toml: &str)

Source

pub fn add_config_file(&mut self, filename: &str, data: Vec<u8>)

Add a named config file under the config/ prefix. Used by snapshot exports to bundle multiple files (e.g. frostmirror.toml, depends.toml) so the importer can place them back into the config dir.

Source

pub fn write_to_file(&self, path: &Path) -> Result<()>

Write the bundle to a file, compressed with brotli.

Bundle format (before brotli compression):

  • 8 bytes: magic “FMPKG\x00\x01\x00”
  • 4 bytes: number of sections (u32 LE)
  • For each section in the header table:
    • 4 bytes: path length (u32 LE)
    • N bytes: path (UTF-8)
    • 8 bytes: data offset (u64 LE)
    • 8 bytes: data length (u64 LE)
  • Raw section data concatenated

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more