pub struct IndexedRamBundle {
pub module_count: u32,
pub startup_code: String,
/* private fields */
}Expand description
A parsed indexed RAM bundle.
The indexed format is a single binary file used primarily on iOS. It contains a header with a module table followed by startup code and module source code.
Fields§
§module_count: u32Number of modules in the bundle.
startup_code: StringStartup (prelude) code that runs before modules.
Implementations§
Source§impl IndexedRamBundle
impl IndexedRamBundle
Sourcepub fn from_bytes(data: &[u8]) -> Result<Self, RamBundleError>
pub fn from_bytes(data: &[u8]) -> Result<Self, RamBundleError>
Parse an indexed RAM bundle from raw bytes.
The binary layout is:
- Bytes 0..4: magic number (little-endian
u32) =0xFB0BD1E5 - Bytes 4..8: module count (little-endian
u32) - Bytes 8..12: startup code size (little-endian
u32) - Next
module_count * 8bytes: module table entries (offset + length, eachu32LE) - Startup code (UTF-8)
- Module source code at specified offsets (UTF-8)
Sourcepub fn module_count(&self) -> u32
pub fn module_count(&self) -> u32
Returns the number of module slots in the bundle.
Sourcepub fn get_module(&self, id: u32) -> Option<&RamBundleModule>
pub fn get_module(&self, id: u32) -> Option<&RamBundleModule>
Returns a module by its ID, or None if the slot is empty.
Sourcepub fn modules(&self) -> impl Iterator<Item = &RamBundleModule>
pub fn modules(&self) -> impl Iterator<Item = &RamBundleModule>
Iterates over all non-empty modules in the bundle.
Sourcepub fn startup_code(&self) -> &str
pub fn startup_code(&self) -> &str
Returns the startup (prelude) code.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for IndexedRamBundle
impl RefUnwindSafe for IndexedRamBundle
impl Send for IndexedRamBundle
impl Sync for IndexedRamBundle
impl Unpin for IndexedRamBundle
impl UnsafeUnpin for IndexedRamBundle
impl UnwindSafe for IndexedRamBundle
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