#[non_exhaustive]pub struct InstallEnv<'a> {
pub fetcher: &'a dyn Fetcher,
pub progress: &'a dyn Progress,
pub cache_root: &'a Path,
pub source_fetcher: Option<&'a dyn SourceFetcher>,
pub machine_auth: Option<&'a HashMap<String, AuthCredentials>>,
pub autoload_marker: &'a str,
pub wording: Wording<'a>,
}Expand description
The runtime seams an install needs, injected so the crate stays free of any
HTTP-client / progress-bar / paths policy. Build it with
InstallEnv::new plus the with_* methods, and pass it by reference to
install_from_lock.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.fetcher: &'a dyn FetcherDownloads each dist URL to a verified cache file. Use
crate::ReqwestFetcher for the batteries-included default.
progress: &'a dyn ProgressPer-package progress callbacks. Use crate::NoProgress for silence.
cache_root: &'a PathDirectory the dist archives are cached under (persistent across runs;
created if absent). Composer keeps the equivalent in
~/.composer/cache/files/.
source_fetcher: Option<&'a dyn SourceFetcher>Installs packages the lock pins to a git source with no dist. None
(the default) makes such packages a preflight error.
machine_auth: Option<&'a HashMap<String, AuthCredentials>>Machine-wide credentials from the caller’s own store (a CLI’s login
command, say), merged above the global auth.json and below the
project’s sources: composer.json config, project auth.json and
COMPOSER_AUTH still win.
autoload_marker: &'a strFile name, under vendor/composer/, of the autoloader freshness
marker. Defaults to .composer-install-autoload-fresh.
wording: Wording<'a>How warnings and preflight blockers name the calling tool and its
commands. Defaults to tool-neutral text; see Wording.
Implementations§
Source§impl<'a> InstallEnv<'a>
impl<'a> InstallEnv<'a>
Sourcepub fn new(
fetcher: &'a dyn Fetcher,
progress: &'a dyn Progress,
cache_root: &'a Path,
) -> Self
pub fn new( fetcher: &'a dyn Fetcher, progress: &'a dyn Progress, cache_root: &'a Path, ) -> Self
The required seams: a dist fetcher, a progress sink, and the dist cache
directory. Source installs are off until
with_source_fetcher.
Sourcepub fn with_wording(self, wording: Wording<'a>) -> Self
pub fn with_wording(self, wording: Wording<'a>) -> Self
Name the calling tool and its commands in warnings and preflight
blockers; see Wording.
Sourcepub fn with_machine_auth(
self,
auth: &'a HashMap<String, AuthCredentials>,
) -> Self
pub fn with_machine_auth( self, auth: &'a HashMap<String, AuthCredentials>, ) -> Self
Add machine-wide credentials from the caller’s own store; see
machine_auth for the precedence.
Sourcepub fn with_autoload_marker(self, name: &'a str) -> Self
pub fn with_autoload_marker(self, name: &'a str) -> Self
Use another file name for the autoloader freshness marker, so a tool that already writes its own keeps its warm state.
Sourcepub fn with_source_fetcher(self, source_fetcher: &'a dyn SourceFetcher) -> Self
pub fn with_source_fetcher(self, source_fetcher: &'a dyn SourceFetcher) -> Self
Install git-source packages with source_fetcher — typically a
crate::GitSourceFetcher.
Trait Implementations§
Source§impl<'a> Clone for InstallEnv<'a>
impl<'a> Clone for InstallEnv<'a>
impl<'a> Copy for InstallEnv<'a>
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for InstallEnv<'a>
impl<'a> !UnwindSafe for InstallEnv<'a>
impl<'a> Forget for InstallEnv<'a>
impl<'a> Freeze for InstallEnv<'a>
impl<'a> Move for InstallEnv<'a>
impl<'a> Send for InstallEnv<'a>
impl<'a> Sync for InstallEnv<'a>
impl<'a> Unpin for InstallEnv<'a>
impl<'a> UnsafeUnpin for InstallEnv<'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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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