pub struct DependencyResolver<'a> { /* private fields */ }Expand description
Used to resolve dependencies for a WIT package.
Implementations§
Source§impl<'a> DependencyResolver<'a>
impl<'a> DependencyResolver<'a>
Sourcepub fn new(
config: Option<Config>,
lock_file: Option<&'a LockFile>,
cache: FileCache,
) -> Result<Self>
pub fn new( config: Option<Config>, lock_file: Option<&'a LockFile>, cache: FileCache, ) -> Result<Self>
Creates a new dependency resolver. If config is None, then the resolver will be set to
offline mode and a lock file must be given as well. Anything that will require network
access will fail in offline mode.
Sourcepub fn new_with_client(
client: CachingClient<FileCache>,
lock_file: Option<&'a LockFile>,
) -> Result<Self>
pub fn new_with_client( client: CachingClient<FileCache>, lock_file: Option<&'a LockFile>, ) -> Result<Self>
Creates a new dependency resolver with the given client. This is useful when you already have a client available. If the client is set to offline mode, then a lock file must be given or this will error
Sourcepub async fn add_dependency(
&mut self,
name: &PackageRef,
dependency: &Dependency,
) -> Result<()>
pub async fn add_dependency( &mut self, name: &PackageRef, dependency: &Dependency, ) -> Result<()>
Add a dependency to the resolver. If the dependency already exists, then it will be ignored.
To override an existing dependency, use override_dependency.
Sourcepub async fn override_dependency(
&mut self,
name: &PackageRef,
dependency: &Dependency,
) -> Result<()>
pub async fn override_dependency( &mut self, name: &PackageRef, dependency: &Dependency, ) -> Result<()>
Add a dependency to the resolver. If the dependency already exists, then it will be overridden.
Sourcepub async fn add_packages(
&mut self,
packages: impl IntoIterator<Item = (PackageRef, VersionReq)>,
) -> Result<()>
pub async fn add_packages( &mut self, packages: impl IntoIterator<Item = (PackageRef, VersionReq)>, ) -> Result<()>
A helper function for adding an iterator of package refs and their associated version requirements to the resolver
Sourcepub async fn resolve(self) -> Result<DependencyResolutionMap>
pub async fn resolve(self) -> Result<DependencyResolutionMap>
Resolve all dependencies.
This will download all dependencies that are not already present in client storage.
Returns the dependency resolution map.
Auto Trait Implementations§
impl<'a> Freeze for DependencyResolver<'a>
impl<'a> !RefUnwindSafe for DependencyResolver<'a>
impl<'a> Send for DependencyResolver<'a>
impl<'a> Sync for DependencyResolver<'a>
impl<'a> Unpin for DependencyResolver<'a>
impl<'a> !UnwindSafe for DependencyResolver<'a>
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
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more