Commit graph

12 commits

Author SHA1 Message Date
Jiahao XU
bd39ce754f
Fix Vfs::add_path: Use to_string_lossy
instead of `to_str` to be compatible with the implementation in
`cargo_toml`:

https://docs.rs/cargo_toml/0.11.5/src/cargo_toml/afs.rs.html#24

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-12 19:23:03 +10:00
Jiahao XU
b88e384f95
Fix Vfs::add_path: Add insert filename instead of path
into the `HashSet<Box<Path>>`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-12 19:17:06 +10:00
Jiahao XU
989be49cb0
Fix confusing doc of Vfs::add_path
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-12 17:13:48 +10:00
Jiahao XU
24b1941c1a
Simplify fetch_crate_cratesio: Rm unused param temp_dir
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-12 17:09:17 +10:00
Jiahao XU
f25306ff97
Simplify download_tar_based_and_visit: Rm unused param
`path`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-12 17:07:29 +10:00
Jiahao XU
e68eea35fe
Mark type ManifestVisitor as pub(super)
Since mod `cretesio` is the only one need to have access to it.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-12 16:40:51 +10:00
Jiahao XU
5bb5d12949
Optimize fetch_crate_cratesio using ManifestVisitor
and `download_tar_based_and_visit`.

By using these two items, we avoid any I/O altogether.
Everything happens in memory, thus there will be no i/o related errors
or cost.

This commit does not regress anything because
`helpers::load_manifest_path` calls `Manifest::from_path_with_metadata`,
which read in the whole `Cargo.toml` file at once.

Thus this commit would not cause any OOM when the the original code
would not.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-12 16:37:53 +10:00
Jiahao XU
f3d3c488e3
Impl new type `ManifestVisitor
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-12 16:32:36 +10:00
Jiahao XU
44d43113f4
Forward impl AbstractFilesystem for &Vfs
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-12 16:08:41 +10:00
Jiahao XU
3c30722a06
Impl new type Vfs which impl AbstractFilesystem
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-12 01:57:34 +10:00
Jiahao XU
0eb9424f17
Set vis of find_version to pub(super)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 22:47:47 +10:00
Jiahao XU
6c6055da69
Refactor mod drivers: Extract out sub mods
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 22:43:45 +10:00