pub struct Bundle {
pub id: String,
pub version: Version,
pub format: String,
}Expand description
Represents a plugin bundle with its metadata.
A Bundle contains the essential information needed to identify and manage a plugin, including its unique identifier, version, and format. This information is used throughout the Plux system for plugin discovery, dependency resolution, and lifecycle management.
§Fields
id- Unique identifier for the plugin (e.g., “calculator”, “logger”)version- Semantic version of the plugin (e.g., “1.0.0”)format- File format/extension of the plugin (e.g., “lua”, “rs”, “wasm”)
§Format
Plugin bundles follow the naming convention: {id}-v{version}.{format}
For example: calculator-v1.0.0.lua or renderer-v2.1.0.wasm
Fields§
§id: StringUnique identifier for the plugin
version: VersionSemantic version of the plugin
format: StringFile format/extension of the plugin
Implementations§
Source§impl Bundle
impl Bundle
Sourcepub fn from_filename<S>(filename: &S) -> Result<Self, BundleFromError>
pub fn from_filename<S>(filename: &S) -> Result<Self, BundleFromError>
Creates a Bundle from a filename string.
Parses a plugin filename following the standard Plux naming convention
{id}-v{version}.{format} and extracts the bundle information.
§Parameters
filename- The filename to parse (e.g., “calculator-v1.0.0.lua”)
§Returns
Returns Result<Self, BundleFromError> containing the parsed Bundle on success,
or an error if the filename doesn’t match the expected format.
§Examples
use plux_rs::Bundle;
let bundle = Bundle::from_filename("my_plugin-v1.2.3.lua")?;
assert_eq!(bundle.id, "my_plugin");
assert_eq!(bundle.version.to_string(), "1.2.3");
assert_eq!(bundle.format, "lua");§Errors
This function will return an error if:
- The filename cannot be converted to a string
- The filename doesn’t contain a format extension
- The filename doesn’t contain a version marker “-v”
- The ID, version, or format parts are empty
- The version string is not a valid semantic version
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Bundle
impl<'de> Deserialize<'de> for Bundle
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Ord for Bundle
impl Ord for Bundle
Source§impl<ID: AsRef<str>> PartialOrd<(ID, &Version)> for Bundle
impl<ID: AsRef<str>> PartialOrd<(ID, &Version)> for Bundle
Source§impl<O: Send + Sync, I: Info> PartialOrd<Bundle> for Plugin<'_, O, I>
impl<O: Send + Sync, I: Info> PartialOrd<Bundle> for Plugin<'_, O, I>
Source§impl<O: Send + Sync, I: Info> PartialOrd<Plugin<'_, O, I>> for Bundle
impl<O: Send + Sync, I: Info> PartialOrd<Plugin<'_, O, I>> for Bundle
Source§impl PartialOrd for Bundle
impl PartialOrd for Bundle
impl Eq for Bundle
impl StructuralPartialEq for Bundle
Auto Trait Implementations§
impl Freeze for Bundle
impl RefUnwindSafe for Bundle
impl Send for Bundle
impl Sync for Bundle
impl Unpin for Bundle
impl UnwindSafe for Bundle
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more