#[non_exhaustive]pub struct ResolvedPackage {
pub name: String,
pub version: String,
pub source: ResolvedSource,
pub dependencies: Vec<String>,
}Expand description
Resolved package information from a lock file.
Contains the exact version and source information for a dependency as resolved by the package manager.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.name: StringPackage name
version: StringResolved version (exact version from lock file)
source: ResolvedSourceSource information (registry URL, git commit, path)
dependencies: Vec<String>Dependencies of this package (for dependency tree analysis)
Implementations§
Source§impl ResolvedPackage
impl ResolvedPackage
Sourcepub fn new(name: String, version: String, source: ResolvedSource) -> Self
pub fn new(name: String, version: String, source: ResolvedSource) -> Self
Constructs a ResolvedPackage from its three required fields, with
Self::dependencies left empty — chain Self::with_dependencies to attach them.
Needed because Self is #[non_exhaustive]: a struct literal only works inside
this crate, so every other crate must go through this constructor instead.
§Examples
use deps_core::lockfile::{ResolvedPackage, ResolvedSource};
let package = ResolvedPackage::new(
"serde".to_string(),
"1.0.195".to_string(),
ResolvedSource::Registry {
url: "https://github.com/rust-lang/crates.io-index".into(),
checksum: "abc123".into(),
},
);
assert!(package.dependencies.is_empty());Sourcepub fn with_dependencies(self, dependencies: Vec<String>) -> Self
pub fn with_dependencies(self, dependencies: Vec<String>) -> Self
Attaches this package’s own dependencies. See Self::dependencies.
Trait Implementations§
Source§impl Clone for ResolvedPackage
impl Clone for ResolvedPackage
Source§impl Debug for ResolvedPackage
impl Debug for ResolvedPackage
impl Eq for ResolvedPackage
Source§impl PartialEq for ResolvedPackage
impl PartialEq for ResolvedPackage
impl StructuralPartialEq for ResolvedPackage
Auto Trait Implementations§
impl Freeze for ResolvedPackage
impl RefUnwindSafe for ResolvedPackage
impl Send for ResolvedPackage
impl Sync for ResolvedPackage
impl Unpin for ResolvedPackage
impl UnsafeUnpin for ResolvedPackage
impl UnwindSafe for ResolvedPackage
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§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.