pub struct Downloader<R> {
pub source: DownloadSource,
pub game_independent: bool,
pub verify_data: bool,
pub java_path: String,
pub reporter: Option<R>,
/* private fields */
}
Expand description
下载结构,用于存储下载所需的信息,并通过附带的扩展特质下载需要的东西
Fields§
§source: DownloadSource
使用的下载源
game_independent: bool
是否使用版本独立方式安装
这个会影响 Optifine 以模组形式的安装路径
(会被安装在 版本/mods 文件夹里还是 .minecraft/mods 文件夹里)
verify_data: bool
是否验证已存在的文件是否正确
java_path: String
任意的 Java 运行时执行文件目录
在安装 Forge 时会使用
reporter: Option<R>
下载的进度报告对象
Implementations§
Source§impl<R> Downloader<R>
impl<R> Downloader<R>
Sourcepub fn set_minecraft_path(&mut self, dot_minecraft_path: impl AsRef<Path>)
pub fn set_minecraft_path(&mut self, dot_minecraft_path: impl AsRef<Path>)
设置安装的目录,传入一个 .minecraft
文件夹路径作为参数
游戏将会被安装到此处
Sourcepub fn with_minecraft_path(self, dot_minecraft_path: impl AsRef<Path>) -> Self
pub fn with_minecraft_path(self, dot_minecraft_path: impl AsRef<Path>) -> Self
Builder 模式的 Downloader::set_minecraft_path
Source§impl<R: Reporter> Downloader<R>
impl<R: Reporter> Downloader<R>
Sourcepub fn with_reporter(self, reporter: R) -> Self
pub fn with_reporter(self, reporter: R) -> Self
设置一个进度报告对象,下载进度将会被上报给这个对象
Sourcepub fn with_source(self, source: DownloadSource) -> Self
pub fn with_source(self, source: DownloadSource) -> Self
设置一个下载源
Sourcepub fn with_game_independent(self, game_independent: bool) -> Self
pub fn with_game_independent(self, game_independent: bool) -> Self
设置是否使用版本独立方式安装
这个会影响 Optifine 以模组形式的安装路径
(会被安装在 版本/mods 文件夹里还是 .minecraft/mods 文件夹里)
Sourcepub fn with_parallel_amount(self, limit: usize) -> Self
pub fn with_parallel_amount(self, limit: usize) -> Self
设置下载时的并发量,如果为 0 则不限制
Sourcepub fn with_verify_data(self) -> Self
pub fn with_verify_data(self) -> Self
是否强制校验已下载的文件以确认是否需要重新下载
如不强制则仅检测文件是否存在
Trait Implementations§
Source§impl<R: Reporter> AuthlibDownloadExt for Downloader<R>
impl<R: Reporter> AuthlibDownloadExt for Downloader<R>
Source§fn download_authlib_injector<'life0, 'life1, 'async_trait>(
&'life0 self,
dest_path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn download_authlib_injector<'life0, 'life1, 'async_trait>(
&'life0 self,
dest_path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
下载最新版本的 Authlib Injector 并存放到指定路径,如果路径的文件夹不存在则会先创建它,如果文件已存在则会被覆盖
Source§impl<R: Reporter> Clone for Downloader<R>
impl<R: Reporter> Clone for Downloader<R>
Source§impl<R: Debug> Debug for Downloader<R>
impl<R: Debug> Debug for Downloader<R>
Source§impl<R: Reporter> Default for Downloader<R>
impl<R: Reporter> Default for Downloader<R>
Source§impl<R: Reporter> FabricDownloadExt for Downloader<R>
impl<R: Reporter> FabricDownloadExt for Downloader<R>
Source§fn get_avaliable_loaders<'life0, 'life1, 'async_trait>(
&'life0 self,
vanilla_version: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<LoaderMetaItem>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_avaliable_loaders<'life0, 'life1, 'async_trait>(
&'life0 self,
vanilla_version: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<LoaderMetaItem>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
根据原版版本号获取该版本下可用的 Fabric 模组加载器
Source§fn download_library<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn download_library<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
下载 Fabric 模组加载器所需的库文件
Source§fn download_fabric_pre<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
version_name: &'life1 str,
version_id: &'life2 str,
loader_version: &'life3 str,
) -> 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 download_fabric_pre<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
version_name: &'life1 str,
version_id: &'life2 str,
loader_version: &'life3 str,
) -> 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,
下载 Fabric 模组加载器,安装时需要配合 download_fabric_post 来合并版本元数据
Source§impl<R: Reporter> ForgeDownloadExt for Downloader<R>
impl<R: Reporter> ForgeDownloadExt for Downloader<R>
Source§fn get_avaliable_installers<'life0, 'life1, 'async_trait>(
&'life0 self,
vanilla_version: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<ForgeVersionsData>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_avaliable_installers<'life0, 'life1, 'async_trait>(
&'life0 self,
vanilla_version: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<ForgeVersionsData>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
根据纯净版本号获取当前可用的所有 Forge 版本
Source§fn install_forge_pre<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
version_id: &'life1 str,
vanilla_version: &'life2 str,
forge_version: &'life3 str,
) -> 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_forge_pre<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
version_id: &'life1 str,
vanilla_version: &'life2 str,
forge_version: &'life3 str,
) -> 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,
运行安装 Forge 模组加载器的预安装步骤 Read more
Source§fn install_forge_post<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
version_name: &'life1 str,
version_id: &'life2 str,
forge_version: &'life3 str,
) -> 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_forge_post<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
version_name: &'life1 str,
version_id: &'life2 str,
forge_version: &'life3 str,
) -> 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,
运行安装 Forge 模组加载器的后安装步骤 Read more
Source§impl<R: Reporter> GameDownload<'_> for Downloader<R>
impl<R: Reporter> GameDownload<'_> for Downloader<R>
Source§fn download_game<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>(
&'life0 self,
version_name: &'life1 str,
vanilla: VersionInfo,
fabric: &'life2 str,
quiltmc: &'life3 str,
forge: &'life4 str,
optifine: &'life5 str,
) -> 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,
'life4: 'async_trait,
'life5: 'async_trait,
fn download_game<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>(
&'life0 self,
version_name: &'life1 str,
vanilla: VersionInfo,
fabric: &'life2 str,
quiltmc: &'life3 str,
forge: &'life4 str,
optifine: &'life5 str,
) -> 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,
'life4: 'async_trait,
'life5: 'async_trait,
根据参数安装一个游戏,允许安装模组加载器
Source§impl<R: Reporter> OptifineDownloadExt for Downloader<R>
impl<R: Reporter> OptifineDownloadExt for Downloader<R>
Source§fn get_avaliable_installers<'life0, 'life1, 'async_trait>(
&'life0 self,
vanilla_version: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<OptifineVersionMeta>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_avaliable_installers<'life0, 'life1, 'async_trait>(
&'life0 self,
vanilla_version: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<OptifineVersionMeta>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
根据纯净版本号获取当前可用的所有 Optifine 版本
Source§fn download_optifine<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
vanilla_version: &'life1 str,
optifine_type: &'life2 str,
optifine_patch: &'life3 str,
dest_path: &'life4 str,
) -> 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,
'life4: 'async_trait,
fn download_optifine<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
vanilla_version: &'life1 str,
optifine_type: &'life2 str,
optifine_patch: &'life3 str,
dest_path: &'life4 str,
) -> 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,
'life4: 'async_trait,
下载 Optifine 版本
Source§fn install_optifine<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
version_name: &'life1 str,
vanilla_version: &'life2 str,
optifine_type: &'life3 str,
optifine_patch: &'life4 str,
as_mod: bool,
) -> 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,
'life4: 'async_trait,
fn install_optifine<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
version_name: &'life1 str,
vanilla_version: &'life2 str,
optifine_type: &'life3 str,
optifine_patch: &'life4 str,
as_mod: bool,
) -> 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,
'life4: 'async_trait,
安装 Optifine 版本
Source§impl<R: Reporter> QuiltMCDownloadExt for Downloader<R>
impl<R: Reporter> QuiltMCDownloadExt for Downloader<R>
Source§fn get_avaliable_loaders<'life0, 'life1, 'async_trait>(
&'life0 self,
vanilla_version: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<LoaderMetaItem>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_avaliable_loaders<'life0, 'life1, 'async_trait>(
&'life0 self,
vanilla_version: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<LoaderMetaItem>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
根据原版版本号获取该版本下可用的 QuiltMC 模组加载器
Source§fn download_library<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
url: String,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn download_library<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
url: String,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
下载 QuiltMC 模组加载器所需的库文件
Source§fn download_quiltmc_pre<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
version_name: &'life1 str,
version_id: &'life2 str,
loader_version: &'life3 str,
) -> 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 download_quiltmc_pre<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
version_name: &'life1 str,
version_id: &'life2 str,
loader_version: &'life3 str,
) -> 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,
下载 QuiltMC 模组加载器,安装时需要配合 download_quiltmc_post 来合并版本元数据
Source§impl<R: Reporter> VanillaDownloadExt for Downloader<R>
impl<R: Reporter> VanillaDownloadExt for Downloader<R>
Source§fn get_avaliable_vanilla_versions<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<VersionManifest>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_avaliable_vanilla_versions<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<VersionManifest>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
获取现在所有可下载版本
Source§fn download_vanilla_jar<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
path: &'life1 str,
save_path: &'life2 str,
_sha1: &'life3 str,
) -> 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 download_vanilla_jar<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
path: &'life1 str,
save_path: &'life2 str,
_sha1: &'life3 str,
) -> 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,
下载原版客户端 JAR 文件
Source§fn download_library<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
sha1: &'life1 str,
path: &'life2 str,
save_path: &'life3 str,
) -> 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 download_library<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
sha1: &'life1 str,
path: &'life2 str,
save_path: &'life3 str,
) -> 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,
下载一个依赖库,并存放到指定位置
Source§fn download_asset_index<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
name: &'life1 str,
url: &'life2 str,
save_path: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<AssetIndexes>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn download_asset_index<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
name: &'life1 str,
url: &'life2 str,
save_path: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<AssetIndexes>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
下载游戏资源索引
Source§fn download_asset<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
sha1: &'life1 str,
name: &'life2 str,
save_path: &'life3 str,
is_pre: bool,
r: Option<impl 'async_trait + Reporter>,
) -> 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 download_asset<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
sha1: &'life1 str,
name: &'life2 str,
save_path: &'life3 str,
is_pre: bool,
r: Option<impl 'async_trait + Reporter>,
) -> 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,
下载一个游戏素材,并存放到指定位置
Source§fn download_libraries<'life0, 'life1, 'async_trait>(
&'life0 self,
libraries: &'life1 [Library],
) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn download_libraries<'life0, 'life1, 'async_trait>(
&'life0 self,
libraries: &'life1 [Library],
) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
下载一组依赖库,安装位置由特质实现而定
Source§fn download_vanilla<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
version_name: &'life1 str,
version_meta: &'life2 VersionMeta,
is_repair: bool,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn download_vanilla<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
version_name: &'life1 str,
version_meta: &'life2 VersionMeta,
is_repair: bool,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
下载一个游戏版本
Source§fn install_vanilla<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
version_name: &'life1 str,
version_info: &'life2 VersionInfo,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn install_vanilla<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
version_name: &'life1 str,
version_info: &'life2 VersionInfo,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
安装一个游戏版本
Auto Trait Implementations§
impl<R> !Freeze for Downloader<R>
impl<R> RefUnwindSafe for Downloader<R>where
R: RefUnwindSafe,
impl<R> Send for Downloader<R>where
R: Send,
impl<R> Sync for Downloader<R>where
R: Sync,
impl<R> Unpin for Downloader<R>where
R: Unpin,
impl<R> UnwindSafe for Downloader<R>where
R: UnwindSafe,
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