pub struct BundleBuilder { /* private fields */ }Expand description
Builds a .pkg bundle file.
Implementations§
Source§impl BundleBuilder
impl BundleBuilder
pub fn new() -> Self
pub fn add_section(&mut self, kind: SectionKind, path: String, data: Vec<u8>)
pub fn add_manifest(&mut self, manifest: &Manifest) -> Result<()>
pub fn add_crate_file(&mut self, name: &str, version: &str, data: Vec<u8>)
pub fn add_index_entry(&mut self, name: &str, data: Vec<u8>)
pub fn add_rustup_file(&mut self, target: &str, filename: &str, data: Vec<u8>)
pub fn add_dist_file(&mut self, relative_path: &str, data: Vec<u8>)
pub fn add_config(&mut self, config_toml: &str)
Sourcepub fn add_config_file(&mut self, filename: &str, data: Vec<u8>)
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.
Sourcepub fn write_to_file(&self, path: &Path) -> Result<()>
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§
impl Freeze for BundleBuilder
impl RefUnwindSafe for BundleBuilder
impl Send for BundleBuilder
impl Sync for BundleBuilder
impl Unpin for BundleBuilder
impl UnsafeUnpin for BundleBuilder
impl UnwindSafe for BundleBuilder
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
Mutably borrows from an owned value. Read more