pub struct BundleLoader { /* private fields */ }Expand description
Loader for plugin bundles.
§Example
use rustbridge_bundle::loader::BundleLoader;
let mut loader = BundleLoader::open("my-plugin-1.0.0.rbp")?;
let manifest = loader.manifest();
// Extract library for current platform to temp directory
let library_path = loader.extract_library_for_current_platform("/tmp/plugins")?;Implementations§
Source§impl BundleLoader
impl BundleLoader
Sourcepub fn open<P: AsRef<Path>>(path: P) -> BundleResult<Self>
pub fn open<P: AsRef<Path>>(path: P) -> BundleResult<Self>
Open a bundle file for reading.
Sourcepub fn supports_current_platform(&self) -> bool
pub fn supports_current_platform(&self) -> bool
Check if the bundle supports the current platform.
Sourcepub fn current_platform_info(&self) -> Option<&PlatformInfo>
pub fn current_platform_info(&self) -> Option<&PlatformInfo>
Get the platform info for the current platform.
Sourcepub fn extract_library<P: AsRef<Path>>(
&mut self,
platform: Platform,
output_dir: P,
) -> BundleResult<PathBuf>
pub fn extract_library<P: AsRef<Path>>( &mut self, platform: Platform, output_dir: P, ) -> BundleResult<PathBuf>
Extract the library for a specific platform to a directory.
Extracts the release variant (default). For other variants,
use extract_library_variant instead.
Returns the path to the extracted library file.
Sourcepub fn extract_library_variant<P: AsRef<Path>>(
&mut self,
platform: Platform,
variant: &str,
output_dir: P,
) -> BundleResult<PathBuf>
pub fn extract_library_variant<P: AsRef<Path>>( &mut self, platform: Platform, variant: &str, output_dir: P, ) -> BundleResult<PathBuf>
Extract a specific variant of the library for a platform.
Returns the path to the extracted library file.
Sourcepub fn list_variants(&self, platform: Platform) -> Vec<&str>
pub fn list_variants(&self, platform: Platform) -> Vec<&str>
List all available variants for a platform.
Sourcepub fn has_variant(&self, platform: Platform, variant: &str) -> bool
pub fn has_variant(&self, platform: Platform, variant: &str) -> bool
Check if a specific variant exists for a platform.
Sourcepub fn build_info(&self) -> Option<&BuildInfo>
pub fn build_info(&self) -> Option<&BuildInfo>
Get the build info from the manifest.
Sourcepub fn extract_library_for_current_platform<P: AsRef<Path>>(
&mut self,
output_dir: P,
) -> BundleResult<PathBuf>
pub fn extract_library_for_current_platform<P: AsRef<Path>>( &mut self, output_dir: P, ) -> BundleResult<PathBuf>
Extract the library for the current platform to a directory.
Returns the path to the extracted library file.
Sourcepub fn read_file(&mut self, path: &str) -> BundleResult<Vec<u8>>
pub fn read_file(&mut self, path: &str) -> BundleResult<Vec<u8>>
Read a file from the bundle as bytes.
Sourcepub fn read_file_string(&mut self, path: &str) -> BundleResult<String>
pub fn read_file_string(&mut self, path: &str) -> BundleResult<String>
Read a file from the bundle as a string.
Sourcepub fn list_files(&self) -> Vec<String>
pub fn list_files(&self) -> Vec<String>
List all files in the bundle.