pub struct Dependency {
pub kind: DependencyKind,
pub from: PackageID,
pub on: PackageID,
/* private fields */
}Fields§
§kind: DependencyKind§from: PackageID§on: PackageIDImplementations§
Source§impl Dependency
impl Dependency
pub fn svs(&self) -> Option<&SourceVersionSpecifier>
Sourcepub fn alias_name(&self) -> Option<PackageNameBorrowed<'_>>
pub fn alias_name(&self) -> Option<PackageNameBorrowed<'_>>
If the dependency is from npm, aliasing a package with a different name,
this represents the name under which it’s aliased, e.g. if package.json defines
the dependency as "lodash": "npm:@chastelock/lodash-fork@^4.0.0",
crate::Package::name will be @chastelock/lodash-fork, but crate::Dependency::alias_name
will be lodash. (If dependency is not from npm, the behavior is undefined.)
let dependencies = chastefile.package_dependencies(root_pid);
let dependency = dependencies.first().unwrap();
assert_eq!(chastefile.package(dependency.on).name().unwrap(), "@chastelock/lodash-fork");
assert_eq!(dependency.alias_name().unwrap(), "lodash");Trait Implementations§
Source§impl Clone for Dependency
impl Clone for Dependency
Source§fn clone(&self) -> Dependency
fn clone(&self) -> Dependency
Returns a copy 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 moreAuto 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