Jiahao XU
241b763477
Use CompactString
for field CrateVersionSource::name
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-28 23:14:00 +10:00
Jiahao XU
cb4cffd0ab
Fix confusing comment for field MetaData::other
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-28 20:33:24 +10:00
Jiahao XU
0d8b865ba4
Update binstall_v1::default_path
and fix typo in it
...
The postfix should be `.json`, not `.toml`.
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-28 19:50:10 +10:00
Jiahao XU
c5db0fefb5
Use Vec
for field MetaData::other
...
by using `tuple_vec_map` to make the `Vec<(CompactString,
serde_json::Value)>` appears as a map.
This is OK because we don't access that part anyway and only add such
field to avoid losing any information when deserialize, modify it and
serialize it again to overwrite existing metafile.
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-28 19:45:47 +10:00
Jiahao XU
4ad8e4f46e
Add new dep serde-tuple-vec-map v1.0.1
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-28 19:43:58 +10:00
Jiahao XU
98556cb2af
Add field MetaData::other
for forward compatibility
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-28 19:24:14 +10:00
Jiahao XU
00fb2528af
Rm unused import std::fs
in binstall_v1
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-28 18:09:53 +10:00
Jiahao XU
73af5b2824
Test appending behavior of append_to_path
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-28 18:09:38 +10:00
Jiahao XU
96d90c0376
Fix append_to_path
on windows: Use create_if_not_exist
...
to open the file.
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-28 18:06:39 +10:00
Jiahao XU
3f72e9b81a
Use tempfile::NamedTempFile
in unit test of binstall_v1
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-28 01:45:54 +10:00
Jiahao XU
3cd9866d32
Use unwrap
in unit test for binstall_v1
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-28 01:24:16 +10:00
Jiahao XU
2490c08840
Write to .binstall-crates.toml
in entry
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-27 23:15:54 +10:00
Jiahao XU
7ccbdb2356
Impl binstall_v1::append
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-27 23:15:46 +10:00
Jiahao XU
d796424199
Fix Records::overwrite
: Update file len
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-27 23:13:41 +10:00
Jiahao XU
c9139fec68
Add unit tests for metafiles::binstall_v1
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-27 23:09:52 +10:00
Jiahao XU
5987acbf95
Derive Clone
for Source
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-27 22:55:16 +10:00
Jiahao XU
671b2fb6f0
Derive Clone
for MetaData
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-27 22:54:32 +10:00
Jiahao XU
cef4dfee5c
Update doc of binstall_v1::Records::insert
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-27 22:32:20 +10:00
Jiahao XU
e6ee493771
Impl binstall_v1::Records::{len, is_empty}
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-27 22:31:51 +10:00
Jiahao XU
8ec33c5b6c
Impl get, contains, insert, replace, remove & take
...
for `binstall_v1::Records`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-27 22:30:58 +10:00
Jiahao XU
04f167491a
Impl Borrow<str>
for MetaData
for Records
...
so that we can use `&str` to query `BTreeSet<MetaData>`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-27 22:25:36 +10:00
Jiahao XU
aba2c87d6d
Impl IntoIterator
for &Records
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-27 22:22:07 +10:00
Jiahao XU
df3af9727e
Impl new fn Records::overwrite
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-27 22:15:21 +10:00
Jiahao XU
1047a782e5
Impl newtype Records
and methods load{_from_path}
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-27 20:36:13 +10:00
Jiahao XU
90203dd467
Impl PartialOrd
and Ord
for MetaData
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-27 20:33:40 +10:00
Jiahao XU
4114b6e7c4
Impl PartialEq
, Eq
and Hash
fo MetaData
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-27 20:19:05 +10:00
Jiahao XU
2f27a5fd93
Refactor: Use binstall_v1::MetaData
in mod binstall
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-27 19:44:16 +10:00
Jiahao XU
05c0d5fcae
Mark binstall_v1::{Source, SourceType}
pub
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-27 19:24:01 +10:00
Jiahao XU
1a8fda1f5e
Impl binstall_v1::Source::cratesio_registry
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-27 19:23:15 +10:00
Jiahao XU
cc13aa911f
Refactor: Extract helpers::cratesio_url
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-27 19:22:45 +10:00
Jiahao XU
5ca1278c22
Add new enum binstall_v1::SourceType
...
Use it to represent source type instead of using `CompactString`.
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-27 19:18:44 +10:00
Jiahao XU
cbd64b039d
Rename binstall_v1::Item
to MetaData
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-27 18:50:21 +10:00
Jiahao XU
951a0f8b9f
Impl binstall_v1::default_path
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-27 18:39:22 +10:00
Jiahao XU
ce50186f4a
Impl io::Seek
for FileLock
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-26 22:52:25 +10:00
Jiahao XU
ebb2d5d0c3
Impl io::Read
for FileLock
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-26 22:51:20 +10:00
Jiahao XU
c6c5dcd79f
Rename binstall_v1::Entry
to Item
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-26 22:47:57 +10:00
Jiahao XU
f0b6b7b1af
Impl binstall_v1::append_to_path
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-26 22:45:59 +10:00
Jiahao XU
461571075d
Impl binstall_v1::Error
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-26 22:45:48 +10:00
Jiahao XU
46c4d6f406
Impl io::Write
for helpers::FileLock
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-26 22:39:15 +10:00
Jiahao XU
172af54cd8
Impl metafiles::binstall_v1::{Entry, Source}
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-26 22:29:10 +10:00
Jiahao XU
93d4dbcd1a
Enable feature serde of dep url
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-26 22:12:04 +10:00
Jiahao XU
f7c798352a
Enable feature serde of semver
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-26 21:57:57 +10:00
Jiahao XU
e990151919
Add new dep serde_json v1.0.82
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-26 21:31:58 +10:00
Félix Saparelli
9d99bfb81f
Add function and example program detecting WASI runability ( #250 )
2022-07-26 23:28:17 +12:00
Jiahao XU
900186e57d
Merge pull request #249 from NobodyXu/optimmiz
...
Optimze updating `CratesToml`
2022-07-26 15:01:39 +10:00
Jiahao XU
2dc246c392
Optimize CratesToml
: Use CompactString
for bins
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-26 13:48:04 +10:00
Jiahao XU
834b8bb9c5
Enable feature serde of dep compact_str
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-26 13:45:53 +10:00
Jiahao XU
928cc65778
Add new dep compact_str v0.5.2
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-26 13:44:50 +10:00
Jiahao XU
03c8295cd8
Optimize CratesToml
: Use Vec
instead of BTreeSet
...
for storing bins.
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-26 13:43:30 +10:00
Jiahao XU
e86239f9be
Merge pull request #247 from NobodyXu/add-more-features
...
Add more features
2022-07-25 19:56:30 +10:00