pub struct PluginInfo { /* private fields */ }Expand description
Plugin metadata and compatibility information.
PluginInfo contains all the metadata needed to identify, validate,
and load a plugin. This includes version information, dependencies,
capabilities, and compatibility requirements.
§Example
use trustformers_core::plugins::PluginInfo;
let info = PluginInfo::new(
"custom_attention",
"1.2.0",
"Optimized multi-head attention with flash attention support",
&["trustformers-core >= 0.1.0", "cuda >= 11.0"]
);
assert_eq!(info.name(), "custom_attention");
assert_eq!(info.version().to_string(), "1.2.0");
assert!(info.is_compatible_with("trustformers-core", "0.2.0"));Implementations§
Source§impl PluginInfo
impl PluginInfo
Sourcepub fn new(
name: &str,
version: &str,
description: &str,
dependencies: &[&str],
) -> Self
pub fn new( name: &str, version: &str, description: &str, dependencies: &[&str], ) -> Self
Creates a new plugin info instance.
§Arguments
name- Plugin nameversion- Plugin version string (must be valid semver)description- Plugin descriptiondependencies- Array of dependency specifications
§Returns
A new PluginInfo instance.
§Panics
Panics if the version string is not valid semver.
§Example
use trustformers_core::plugins::PluginInfo;
let info = PluginInfo::new(
"my_plugin",
"1.0.0",
"A sample plugin",
&["trustformers-core >= 0.1.0"]
);Sourcepub fn description(&self) -> &str
pub fn description(&self) -> &str
Returns the plugin description.
Returns the plugin author.
Sets the plugin author.
Sourcepub fn set_homepage(&mut self, homepage: String)
pub fn set_homepage(&mut self, homepage: String)
Sets the plugin homepage URL.
Sourcepub fn set_license(&mut self, license: String)
pub fn set_license(&mut self, license: String)
Sets the plugin license.
Sourcepub fn dependencies(&self) -> &[Dependency]
pub fn dependencies(&self) -> &[Dependency]
Returns the plugin dependencies.
Sourcepub fn add_dependency(&mut self, dependency: Dependency)
pub fn add_dependency(&mut self, dependency: Dependency)
Adds a dependency requirement.
Sourcepub fn capabilities(&self) -> &[String]
pub fn capabilities(&self) -> &[String]
Returns the plugin capabilities.
Sourcepub fn add_capability(&mut self, capability: String)
pub fn add_capability(&mut self, capability: String)
Adds a capability.
Returns the plugin tags.
Sourcepub fn requirements(&self) -> &SystemRequirements
pub fn requirements(&self) -> &SystemRequirements
Returns the system requirements.
Sourcepub fn set_requirements(&mut self, requirements: SystemRequirements)
pub fn set_requirements(&mut self, requirements: SystemRequirements)
Sets the system requirements.
Sourcepub fn entry_point(&self) -> &str
pub fn entry_point(&self) -> &str
Returns the plugin entry point.
Sourcepub fn set_entry_point(&mut self, entry_point: String)
pub fn set_entry_point(&mut self, entry_point: String)
Sets the plugin entry point.
Sourcepub fn add_metadata(&mut self, key: String, value: Value)
pub fn add_metadata(&mut self, key: String, value: Value)
Adds metadata.
Sourcepub fn is_compatible_with(&self, name: &str, version: &str) -> bool
pub fn is_compatible_with(&self, name: &str, version: &str) -> bool
Trait Implementations§
Source§impl Clone for PluginInfo
impl Clone for PluginInfo
Source§fn clone(&self) -> PluginInfo
fn clone(&self) -> PluginInfo
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PluginInfo
impl Debug for PluginInfo
Source§impl<'de> Deserialize<'de> for PluginInfo
impl<'de> Deserialize<'de> for PluginInfo
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for PluginInfo
impl RefUnwindSafe for PluginInfo
impl Send for PluginInfo
impl Sync for PluginInfo
impl Unpin for PluginInfo
impl UnsafeUnpin for PluginInfo
impl UnwindSafe for PluginInfo
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> ConfigSerializable for Twhere
T: Serialize + for<'de> Deserialize<'de>,
impl<T> ConfigSerializable for Twhere
T: Serialize + for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
Converts
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>
Converts
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