pub struct Dependency {
pub name: String,
pub compatibility: Compatibility,
}Expand description
Describes a dependency of a mod.
Fields§
§name: StringThe internal mod name of the dependency.
compatibility: CompatibilityThe compatibility of the dependency.
Implementations§
Source§impl Dependency
impl Dependency
pub fn new<T: Into<String>>(name: T, compatibility: Compatibility) -> Self
Sourcepub fn required<T: Into<String>>(name: T, version_req: VersionReq) -> Self
pub fn required<T: Into<String>>(name: T, version_req: VersionReq) -> Self
Convenience method for creating a required dependency.
Shortcut for:
let dependency = Dependency::new(name, Compatibility::Compatible(DependencyMode::Required, version_req));Sourcepub fn optional<T: Into<String>>(
name: T,
version_req: VersionReq,
hidden: bool,
) -> Self
pub fn optional<T: Into<String>>( name: T, version_req: VersionReq, hidden: bool, ) -> Self
Convenience method for creating an optional dependency.
Shortcut for:
let dependency = Dependency::new(name, Compatibility::Compatible(DependencyMode::Optional { hidden }, version_req));Sourcepub fn independent<T: Into<String>>(name: T, version_req: VersionReq) -> Self
pub fn independent<T: Into<String>>(name: T, version_req: VersionReq) -> Self
Convenience method for creating an independent dependency.
Shortcut for:
let dependency = Dependency::new(name, Compatibility::Compatible(DependencyMode::Independent, version_req));Sourcepub fn incompatible<T: Into<String>>(name: T) -> Self
pub fn incompatible<T: Into<String>>(name: T) -> Self
Convenience method for creating an incompatible dependency.
Shortcut for:
let dependency = Dependency::new(name, Compatibility::Incompatible);Sourcepub fn parse(s: &str) -> Result<Self, ParseDependencyError>
pub fn parse(s: &str) -> Result<Self, ParseDependencyError>
Parses a Dependency from a string.
§Examples
let dependency = Dependency::parse("my-mod >= 0.17.0")?;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 · 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
Source§impl Display for Dependency
impl Display for Dependency
Source§impl FromStr for Dependency
impl FromStr for Dependency
Source§impl PartialEq for Dependency
impl PartialEq for Dependency
Source§impl Serialize for Dependency
impl Serialize for Dependency
impl Eq 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 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