pub struct Dependency {
pub id: PackageId,
pub version_req: VersionReq,
pub source: String,
pub registry_metadata: Option<Value>,
}Expand description
A declared dependency on another package.
let dep = Dependency::new(
"x753-More_Suits",
VersionReq::parse(">=1.0").unwrap(),
"thunderstore",
);
assert_eq!(dep.id.as_str(), "x753-More_Suits");
let dep = dep.with_registry_metadata(
serde_json::json!({"website_url": "https://thunderstore.io/c/valheim/"}),
);
assert!(dep.registry_metadata.is_some());Fields§
§id: PackageId§version_req: VersionReq§source: String§registry_metadata: Option<Value>Implementations§
Source§impl Dependency
impl Dependency
Sourcepub fn new(
id: impl Into<PackageId>,
version_req: impl Into<VersionReq>,
source: impl Into<String>,
) -> Self
pub fn new( id: impl Into<PackageId>, version_req: impl Into<VersionReq>, source: impl Into<String>, ) -> Self
Create a new dependency with the given identifier, version requirement, and source string.
Sourcepub fn with_registry_metadata(self, metadata: impl Into<Value>) -> Self
pub fn with_registry_metadata(self, metadata: impl Into<Value>) -> Self
Attach registry-specific metadata to this dependency.
let dep = Dependency::new("denikson-BepInExPack_Valheim", VersionReq::STAR, "thunderstore")
.with_registry_metadata(serde_json::json!({"key": "val"}));
assert_eq!(dep.registry_metadata.unwrap()["key"], "val");Trait Implementations§
Source§impl Clone for Dependency
impl Clone for Dependency
Source§fn clone(&self) -> Dependency
fn clone(&self) -> Dependency
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 Dependency
impl Debug for Dependency
Source§impl<'de> Deserialize<'de> for Dependency
impl<'de> Deserialize<'de> for Dependency
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 Dependency
Source§impl PartialEq for Dependency
impl PartialEq for Dependency
Source§impl Serialize for Dependency
impl Serialize for Dependency
impl StructuralPartialEq for Dependency
Auto Trait Implementations§
impl Freeze for Dependency
impl RefUnwindSafe for Dependency
impl Send for Dependency
impl Sync for Dependency
impl Unpin for Dependency
impl UnsafeUnpin for Dependency
impl UnwindSafe for Dependency
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