pub struct DependencySpec {
pub name: String,
pub version_req: String,
}Expand description
Parsed dependency specification (name with optional version requirement).
Result of parsing a dependency string like “python>=3.12” or “glibc”.
Fields§
§name: StringPackage name.
version_req: StringVersion constraint (may be empty if no constraint specified).
Implementations§
Source§impl DependencySpec
impl DependencySpec
Sourcepub fn new(name: impl Into<String>) -> Self
pub fn new(name: impl Into<String>) -> Self
What: Create a new dependency spec with just a name.
Inputs:
name: Package name (will be converted to String).
Output:
- Returns a new
DependencySpecwith empty version requirement.
Details:
- Convenience constructor for dependencies without version constraints.
Sourcepub fn with_version(
name: impl Into<String>,
version_req: impl Into<String>,
) -> Self
pub fn with_version( name: impl Into<String>, version_req: impl Into<String>, ) -> Self
What: Create a new dependency spec with name and version requirement.
Inputs:
name: Package name (will be converted to String).version_req: Version requirement string (e.g., “>=1.2.3”).
Output:
- Returns a new
DependencySpecwith both name and version requirement.
Details:
- Convenience constructor for dependencies with version constraints.
Sourcepub const fn has_version_req(&self) -> bool
pub const fn has_version_req(&self) -> bool
What: Check if this spec has a version requirement.
Inputs:
self: The dependency spec to check.
Output:
- Returns
trueif a version requirement is specified.
Details:
- Checks if
version_reqis non-empty.
Trait Implementations§
Source§impl Clone for DependencySpec
impl Clone for DependencySpec
Source§fn clone(&self) -> DependencySpec
fn clone(&self) -> DependencySpec
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 DependencySpec
impl Debug for DependencySpec
Source§impl Default for DependencySpec
impl Default for DependencySpec
Source§fn default() -> DependencySpec
fn default() -> DependencySpec
Returns the “default value” for a type. Read more
Source§impl Display for DependencySpec
impl Display for DependencySpec
Source§impl PartialEq for DependencySpec
impl PartialEq for DependencySpec
impl Eq for DependencySpec
impl StructuralPartialEq for DependencySpec
Auto Trait Implementations§
impl Freeze for DependencySpec
impl RefUnwindSafe for DependencySpec
impl Send for DependencySpec
impl Sync for DependencySpec
impl Unpin for DependencySpec
impl UnwindSafe for DependencySpec
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> 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> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.