pub struct Depend {
pub id: String,
pub version: VersionReq,
}
Expand description
Represents a dependency on another plugin.
A Depend specifies a plugin that must be available, including both the plugin’s identifier and the acceptable version range.
§Fields
id
- The identifier of the required pluginversion
- Version requirement specifying acceptable versions
§Examples
use plux_rs::Depend;
use semver::VersionReq;
// Require any version 1.x of the "logger" plugin
let dep1 = Depend::new("logger".to_string(), VersionReq::parse("1.*").unwrap());
// Require exactly version 2.0.0 of the "database" plugin
let dep2 = Depend::new("database".to_string(), VersionReq::parse("=2.0.0").unwrap());
Fields§
§id: String
The identifier of the required plugin
version: VersionReq
Version requirement for the dependency
Implementations§
Source§impl Depend
impl Depend
Sourcepub const fn new(name: String, version: VersionReq) -> Self
pub const fn new(name: String, version: VersionReq) -> Self
Creates a new dependency specification.
§Parameters
name
- The identifier of the required pluginversion
- Version requirement for the dependency
§Returns
Returns a new Depend instance.
§Example
use plux_rs::Depend;
use semver::VersionReq;
let dependency = Depend::new("logger".to_string(), VersionReq::parse("1.0").unwrap());
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Depend
impl<'de> Deserialize<'de> for Depend
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
impl Eq for Depend
impl StructuralPartialEq for Depend
Auto Trait Implementations§
impl Freeze for Depend
impl RefUnwindSafe for Depend
impl Send for Depend
impl Sync for Depend
impl Unpin for Depend
impl UnwindSafe for Depend
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<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
Compare self to
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>
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