pub trait Backend: Send + Sync {
Show 16 methods
// Required methods
fn id(&self) -> &str;
fn default_sources(&self) -> Vec<Source>;
fn probe_url(&self, ctx: &Ctx, source: &Source) -> Option<String>;
fn list_remote_versions<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 Ctx,
) -> Pin<Box<dyn Future<Output = Result<Vec<VersionInfo>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn install<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
ctx: &'life1 InstallCtx<'life2>,
tv: &'life3 ToolVersion,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait;
fn bin_paths(&self, ctx: &Ctx, tv: &ToolVersion) -> Result<Vec<PathBuf>>;
fn bin_names(&self, ctx: &Ctx, tv: &ToolVersion) -> Result<Vec<String>>;
// Provided methods
fn aliases(&self) -> &[&str] { ... }
fn resolve_version<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
ctx: &'life1 Ctx,
req: &'life2 ToolRequest,
) -> Pin<Box<dyn Future<Output = Result<ToolVersion>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn ensure_post_install(&self, _ctx: &Ctx, _tv: &ToolVersion) -> Result<()> { ... }
fn uninstall<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
ctx: &'life1 Ctx,
tv: &'life2 ToolVersion,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn list_installed(&self, ctx: &Ctx) -> Result<Vec<String>> { ... }
fn exec_env(
&self,
_ctx: &Ctx,
_tv: &ToolVersion,
) -> Result<BTreeMap<String, String>> { ... }
fn dynamic_install_identity(
&self,
_ctx: &Ctx,
_tv: &ToolVersion,
) -> Result<Option<InstallIdentity>> { ... }
fn validate_dynamic_install(
&self,
_ctx: &Ctx,
_tv: &ToolVersion,
_install_root: &Path,
_identity: &InstallIdentity,
) -> Result<bool> { ... }
fn idiomatic_files(&self) -> &[&str] { ... }
}Expand description
The uniform interface for every SDK. Archive-based backends run the shared
pipeline in install; delegate backends (rustup/corepack) shell out.
Required Methods§
Sourcefn default_sources(&self) -> Vec<Source>
fn default_sources(&self) -> Vec<Source>
The default source list for this backend (official + mirrors).
Sourcefn probe_url(&self, ctx: &Ctx, source: &Source) -> Option<String>
fn probe_url(&self, ctx: &Ctx, source: &Source) -> Option<String>
A representative small URL used to speed-probe a source. Given a source’s download base, return a URL to fetch for measuring throughput.
Sourcefn list_remote_versions<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 Ctx,
) -> Pin<Box<dyn Future<Output = Result<Vec<VersionInfo>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list_remote_versions<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 Ctx,
) -> Pin<Box<dyn Future<Output = Result<Vec<VersionInfo>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
List installable versions (typically parsed from a remote index).
Sourcefn install<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
ctx: &'life1 InstallCtx<'life2>,
tv: &'life3 ToolVersion,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn install<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
ctx: &'life1 InstallCtx<'life2>,
tv: &'life3 ToolVersion,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Install a concrete version.
Provided Methods§
Sourcefn resolve_version<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
ctx: &'life1 Ctx,
req: &'life2 ToolRequest,
) -> Pin<Box<dyn Future<Output = Result<ToolVersion>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn resolve_version<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
ctx: &'life1 Ctx,
req: &'life2 ToolRequest,
) -> Pin<Box<dyn Future<Output = Result<ToolVersion>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Resolve a request (e.g. 20, lts) to a concrete version.
Sourcefn ensure_post_install(&self, _ctx: &Ctx, _tv: &ToolVersion) -> Result<()>
fn ensure_post_install(&self, _ctx: &Ctx, _tv: &ToolVersion) -> Result<()>
Apply idempotent post-install actions to an already installed version.
Sourcefn uninstall<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
ctx: &'life1 Ctx,
tv: &'life2 ToolVersion,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn uninstall<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
ctx: &'life1 Ctx,
tv: &'life2 ToolVersion,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Remove an installed version. Default removes the install dir.
Sourcefn list_installed(&self, ctx: &Ctx) -> Result<Vec<String>>
fn list_installed(&self, ctx: &Ctx) -> Result<Vec<String>>
List locally installed versions (dirs with a complete marker).
Sourcefn exec_env(
&self,
_ctx: &Ctx,
_tv: &ToolVersion,
) -> Result<BTreeMap<String, String>>
fn exec_env( &self, _ctx: &Ctx, _tv: &ToolVersion, ) -> Result<BTreeMap<String, String>>
Environment variables to export when this version is active (e.g. GOROOT, JAVA_HOME).
Sourcefn dynamic_install_identity(
&self,
_ctx: &Ctx,
_tv: &ToolVersion,
) -> Result<Option<InstallIdentity>>
fn dynamic_install_identity( &self, _ctx: &Ctx, _tv: &ToolVersion, ) -> Result<Option<InstallIdentity>>
Exact identity selected for a dynamic install. None retains inventory
discovery for backends whose artifact identity is learned at install.
Sourcefn validate_dynamic_install(
&self,
_ctx: &Ctx,
_tv: &ToolVersion,
_install_root: &Path,
_identity: &InstallIdentity,
) -> Result<bool>
fn validate_dynamic_install( &self, _ctx: &Ctx, _tv: &ToolVersion, _install_root: &Path, _identity: &InstallIdentity, ) -> Result<bool>
Validate provider-specific evidence after shared inventory validation.
Sourcefn idiomatic_files(&self) -> &[&str]
fn idiomatic_files(&self) -> &[&str]
Idiomatic version files this backend understands (e.g. .nvmrc).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".