From aa0de549b200f217e4b8a57d6f60fad04172f1c0 Mon Sep 17 00:00:00 2001 From: Wandalen Date: Tue, 5 Nov 2024 09:42:37 +0200 Subject: [PATCH] NOT READY : Global Refactoring (#1469) async crates --- .github/workflows/module_async_from_push.yml | 24 ++ .github/workflows/module_async_tools_push.yml | 24 ++ .github/workflows/module_graphtools_push.yml | 24 ++ .github/workflows/module_mindx_12_push.yml | 24 ++ .github/workflows/module_mingl_push.yml | 24 ++ .github/workflows/module_minmetal_push.yml | 24 ++ .github/workflows/module_minopengl_push.yml | 24 ++ .github/workflows/module_minvulkan_push.yml | 24 ++ .github/workflows/module_minwebgl_push.yml | 24 ++ .github/workflows/module_minwebgpu_push.yml | 24 ++ .github/workflows/module_minwgpu_push.yml | 24 ++ .../module_proper_path_tools_push.yml | 2 +- .github/workflows/module_pth_push.yml | 24 ++ Cargo.toml | 124 ++++--- Readme.md | 12 +- module/alias/wtest_basic/Cargo.toml | 6 +- module/blank/proper_path_tools/Cargo.toml | 34 ++ .../{core => blank}/proper_path_tools/License | 0 module/blank/proper_path_tools/Readme.md | 33 ++ module/blank/proper_path_tools/src/lib.rs | 11 + .../proper_path_tools/tests/inc/basic_test.rs | 7 + .../blank/proper_path_tools/tests/inc/mod.rs | 4 + .../proper_path_tools/tests/smoke_test.rs | 12 + .../proper_path_tools/tests/tests.rs | 0 module/core/async_from/Cargo.toml | 38 +++ module/core/async_from/License | 22 ++ module/core/async_from/Readme.md | 91 +++++ module/core/async_from/src/lib.rs | 316 ++++++++++++++++++ .../core/async_from/tests/inc/basic_test.rs | 84 +++++ module/core/async_from/tests/inc/mod.rs | 3 + module/core/async_from/tests/tests.rs | 9 + module/core/async_tools/Cargo.toml | 39 +++ module/core/async_tools/License | 22 ++ module/core/async_tools/Readme.md | 6 + module/core/async_tools/src/lib.rs | 79 +++++ .../core/async_tools/tests/inc/basic_test.rs | 84 +++++ module/core/async_tools/tests/inc/mod.rs | 3 + module/core/async_tools/tests/tests.rs | 10 + module/core/clone_dyn/Cargo.toml | 3 +- module/core/clone_dyn/src/lib.rs | 1 - module/core/clone_dyn_meta/Cargo.toml | 2 +- module/core/clone_dyn_types/Cargo.toml | 2 +- module/core/collection_tools/Cargo.toml | 4 +- module/core/data_type/Cargo.toml | 29 +- module/core/data_type/src/lib.rs | 14 +- module/core/derive_tools/Cargo.toml | 2 +- module/core/derive_tools_meta/Cargo.toml | 2 +- module/core/diagnostics_tools/Cargo.toml | 2 +- module/core/error_tools/Cargo.toml | 2 +- module/core/for_each/Cargo.toml | 2 +- module/core/former/Cargo.toml | 4 +- module/core/former_meta/Cargo.toml | 4 +- module/core/former_types/Cargo.toml | 4 +- module/core/implements/Cargo.toml | 2 +- module/core/impls_index/Cargo.toml | 2 +- module/core/impls_index_meta/Cargo.toml | 2 +- module/core/inspect_type/Cargo.toml | 2 +- module/core/interval_adapter/Cargo.toml | 2 +- module/core/is_slice/Cargo.toml | 2 +- module/core/iter_tools/Cargo.toml | 2 +- module/core/iter_tools/src/iter.rs | 2 + module/core/macro_tools/Cargo.toml | 2 +- module/core/mem_tools/Cargo.toml | 2 +- module/core/meta_tools/Cargo.toml | 2 +- module/core/mod_interface/Cargo.toml | 2 +- module/core/mod_interface_meta/Cargo.toml | 2 +- module/core/mod_interface_meta/src/lib.rs | 2 +- module/core/process_tools/Cargo.toml | 6 +- module/core/program_tools/Cargo.toml | 4 +- module/core/proper_path_tools/Readme.md | 35 -- .../{proper_path_tools => pth}/Cargo.toml | 12 +- module/core/pth/License | 22 ++ module/core/pth/Readme.md | 51 +++ module/core/pth/src/as_path.rs | 71 ++++ .../{proper_path_tools => pth}/src/lib.rs | 18 +- .../{proper_path_tools => pth}/src/path.rs | 81 +++-- .../src/path/absolute_path.rs | 228 ++++++------- .../src/path/canonical_path.rs | 53 ++- .../src/path/current_path.rs | 41 ++- module/core/pth/src/path/joining.rs | 191 +++++++++++ .../src/path/native_path.rs | 52 ++- .../src/transitive.rs | 4 +- module/core/pth/src/try_into_cow_path.rs | 111 ++++++ module/core/pth/src/try_into_path.rs | 109 ++++++ .../tests/experiment.rs | 2 +- .../core/pth/tests/inc/absolute_path_test.rs | 5 + .../inc/absolute_path_test/basic_test.rs} | 9 - .../inc/absolute_path_test/from_paths_test.rs | 92 +++++ .../inc/absolute_path_test/try_from_test.rs | 55 +++ module/core/pth/tests/inc/as_path_test.rs | 103 ++++++ .../tests/inc/current_path.rs | 0 .../tests/inc/mod.rs | 13 +- .../tests/inc/path_canonicalize.rs | 0 .../tests/inc/path_change_ext.rs | 0 .../tests/inc/path_common.rs | 0 .../tests/inc/path_ext.rs | 0 .../tests/inc/path_exts.rs | 0 .../tests/inc/path_is_glob.rs | 0 .../tests/inc/path_join_fn_test.rs} | 58 ++-- .../pth/tests/inc/path_join_trait_test.rs | 206 ++++++++++++ .../tests/inc/path_normalize.rs | 0 .../tests/inc/path_relative.rs | 0 .../tests/inc/path_unique_folder_name.rs | 0 .../tests/inc/rebase_path.rs | 0 .../tests/inc/transitive.rs | 4 +- .../pth/tests/inc/try_into_cow_path_test.rs | 124 +++++++ .../core/pth/tests/inc/try_into_path_test.rs | 117 +++++++ .../tests/inc/without_ext.rs | 0 .../tests/smoke_test.rs | 0 module/core/pth/tests/tests.rs | 9 + module/core/strs_tools/Cargo.toml | 2 +- module/core/test_tools/Cargo.toml | 2 +- module/core/test_tools/src/lib.rs | 7 +- module/core/typing_tools/Cargo.toml | 2 +- module/core/variadic_from/Cargo.toml | 2 +- module/core/wtools/Cargo.toml | 3 - module/move/crates_tools/Cargo.toml | 2 +- module/move/unitore/Cargo.toml | 2 +- module/move/unitore/src/action/config.rs | 4 +- module/move/unitore/src/entity/config.rs | 2 +- module/move/unitore/tests/config_add.rs | 2 +- module/move/unitore/tests/config_delete.rs | 2 +- module/move/unitore/tests/frames_download.rs | 6 +- module/move/unitore/tests/query_execute.rs | 20 +- module/move/unitore/tests/table_list.rs | 4 +- module/move/unitore/tests/tables_list.rs | 2 +- module/move/wca/Cargo.toml | 2 +- module/move/willbe/Cargo.toml | 6 +- .../action/readme_modules_headers_renew.rs | 2 +- module/move/willbe/src/tool/path.rs | 4 +- module/move/willbe/src/wtools.rs | 6 +- .../type_constructor/tests/inc/mod.rs | 4 +- .../tests/inc/prelude_test.rs | 136 ++++---- step/Cargo.toml | 2 +- 134 files changed, 3058 insertions(+), 498 deletions(-) create mode 100644 .github/workflows/module_async_from_push.yml create mode 100644 .github/workflows/module_async_tools_push.yml create mode 100644 .github/workflows/module_graphtools_push.yml create mode 100644 .github/workflows/module_mindx_12_push.yml create mode 100644 .github/workflows/module_mingl_push.yml create mode 100644 .github/workflows/module_minmetal_push.yml create mode 100644 .github/workflows/module_minopengl_push.yml create mode 100644 .github/workflows/module_minvulkan_push.yml create mode 100644 .github/workflows/module_minwebgl_push.yml create mode 100644 .github/workflows/module_minwebgpu_push.yml create mode 100644 .github/workflows/module_minwgpu_push.yml create mode 100644 .github/workflows/module_pth_push.yml create mode 100644 module/blank/proper_path_tools/Cargo.toml rename module/{core => blank}/proper_path_tools/License (100%) create mode 100644 module/blank/proper_path_tools/Readme.md create mode 100644 module/blank/proper_path_tools/src/lib.rs create mode 100644 module/blank/proper_path_tools/tests/inc/basic_test.rs create mode 100644 module/blank/proper_path_tools/tests/inc/mod.rs create mode 100644 module/blank/proper_path_tools/tests/smoke_test.rs rename module/{core => blank}/proper_path_tools/tests/tests.rs (100%) create mode 100644 module/core/async_from/Cargo.toml create mode 100644 module/core/async_from/License create mode 100644 module/core/async_from/Readme.md create mode 100644 module/core/async_from/src/lib.rs create mode 100644 module/core/async_from/tests/inc/basic_test.rs create mode 100644 module/core/async_from/tests/inc/mod.rs create mode 100644 module/core/async_from/tests/tests.rs create mode 100644 module/core/async_tools/Cargo.toml create mode 100644 module/core/async_tools/License create mode 100644 module/core/async_tools/Readme.md create mode 100644 module/core/async_tools/src/lib.rs create mode 100644 module/core/async_tools/tests/inc/basic_test.rs create mode 100644 module/core/async_tools/tests/inc/mod.rs create mode 100644 module/core/async_tools/tests/tests.rs delete mode 100644 module/core/proper_path_tools/Readme.md rename module/core/{proper_path_tools => pth}/Cargo.toml (87%) create mode 100644 module/core/pth/License create mode 100644 module/core/pth/Readme.md create mode 100644 module/core/pth/src/as_path.rs rename module/core/{proper_path_tools => pth}/src/lib.rs (67%) rename module/core/{proper_path_tools => pth}/src/path.rs (95%) rename module/core/{proper_path_tools => pth}/src/path/absolute_path.rs (54%) rename module/core/{proper_path_tools => pth}/src/path/canonical_path.rs (85%) rename module/core/{proper_path_tools => pth}/src/path/current_path.rs (67%) create mode 100644 module/core/pth/src/path/joining.rs rename module/core/{proper_path_tools => pth}/src/path/native_path.rs (86%) rename module/core/{proper_path_tools => pth}/src/transitive.rs (98%) create mode 100644 module/core/pth/src/try_into_cow_path.rs create mode 100644 module/core/pth/src/try_into_path.rs rename module/core/{proper_path_tools => pth}/tests/experiment.rs (94%) create mode 100644 module/core/pth/tests/inc/absolute_path_test.rs rename module/core/{proper_path_tools/tests/inc/absolute_path.rs => pth/tests/inc/absolute_path_test/basic_test.rs} (93%) create mode 100644 module/core/pth/tests/inc/absolute_path_test/from_paths_test.rs create mode 100644 module/core/pth/tests/inc/absolute_path_test/try_from_test.rs create mode 100644 module/core/pth/tests/inc/as_path_test.rs rename module/core/{proper_path_tools => pth}/tests/inc/current_path.rs (100%) rename module/core/{proper_path_tools => pth}/tests/inc/mod.rs (57%) rename module/core/{proper_path_tools => pth}/tests/inc/path_canonicalize.rs (100%) rename module/core/{proper_path_tools => pth}/tests/inc/path_change_ext.rs (100%) rename module/core/{proper_path_tools => pth}/tests/inc/path_common.rs (100%) rename module/core/{proper_path_tools => pth}/tests/inc/path_ext.rs (100%) rename module/core/{proper_path_tools => pth}/tests/inc/path_exts.rs (100%) rename module/core/{proper_path_tools => pth}/tests/inc/path_is_glob.rs (100%) rename module/core/{proper_path_tools/tests/inc/path_join.rs => pth/tests/inc/path_join_fn_test.rs} (76%) create mode 100644 module/core/pth/tests/inc/path_join_trait_test.rs rename module/core/{proper_path_tools => pth}/tests/inc/path_normalize.rs (100%) rename module/core/{proper_path_tools => pth}/tests/inc/path_relative.rs (100%) rename module/core/{proper_path_tools => pth}/tests/inc/path_unique_folder_name.rs (100%) rename module/core/{proper_path_tools => pth}/tests/inc/rebase_path.rs (100%) rename module/core/{proper_path_tools => pth}/tests/inc/transitive.rs (96%) create mode 100644 module/core/pth/tests/inc/try_into_cow_path_test.rs create mode 100644 module/core/pth/tests/inc/try_into_path_test.rs rename module/core/{proper_path_tools => pth}/tests/inc/without_ext.rs (100%) rename module/core/{proper_path_tools => pth}/tests/smoke_test.rs (100%) create mode 100644 module/core/pth/tests/tests.rs diff --git a/.github/workflows/module_async_from_push.yml b/.github/workflows/module_async_from_push.yml new file mode 100644 index 0000000000..dd4257fe08 --- /dev/null +++ b/.github/workflows/module_async_from_push.yml @@ -0,0 +1,24 @@ +name : async_from + +on : + push : + branches : + - 'alpha' + - 'beta' + - 'master' + + +env : + CARGO_TERM_COLOR : always + +jobs : + + # async_from + + test : + uses : Wandalen/wTools/.github/workflows/standard_rust_push.yml@alpha + with : + manifest_path : 'module/core/async_from/Cargo.toml' + module_name : 'async_from' + commit_message : ${{ github.event.head_commit.message }} + commiter_username: ${{ github.event.head_commit.committer.username }} diff --git a/.github/workflows/module_async_tools_push.yml b/.github/workflows/module_async_tools_push.yml new file mode 100644 index 0000000000..0310131fd5 --- /dev/null +++ b/.github/workflows/module_async_tools_push.yml @@ -0,0 +1,24 @@ +name : async_tools + +on : + push : + branches : + - 'alpha' + - 'beta' + - 'master' + + +env : + CARGO_TERM_COLOR : always + +jobs : + + # async_tools + + test : + uses : Wandalen/wTools/.github/workflows/standard_rust_push.yml@alpha + with : + manifest_path : 'module/core/async_tools/Cargo.toml' + module_name : 'async_tools' + commit_message : ${{ github.event.head_commit.message }} + commiter_username: ${{ github.event.head_commit.committer.username }} diff --git a/.github/workflows/module_graphtools_push.yml b/.github/workflows/module_graphtools_push.yml new file mode 100644 index 0000000000..81fcfc6c0d --- /dev/null +++ b/.github/workflows/module_graphtools_push.yml @@ -0,0 +1,24 @@ +name : graphtools + +on : + push : + branches : + - 'alpha' + - 'beta' + - 'master' + + +env : + CARGO_TERM_COLOR : always + +jobs : + + # graphtools + + test : + uses : Wandalen/wTools/.github/workflows/standard_rust_push.yml@alpha + with : + manifest_path : 'module/blank/graphtools/Cargo.toml' + module_name : 'graphtools' + commit_message : ${{ github.event.head_commit.message }} + commiter_username: ${{ github.event.head_commit.committer.username }} diff --git a/.github/workflows/module_mindx_12_push.yml b/.github/workflows/module_mindx_12_push.yml new file mode 100644 index 0000000000..dc1bf11265 --- /dev/null +++ b/.github/workflows/module_mindx_12_push.yml @@ -0,0 +1,24 @@ +name : mindx12 + +on : + push : + branches : + - 'alpha' + - 'beta' + - 'master' + + +env : + CARGO_TERM_COLOR : always + +jobs : + + # mindx12 + + test : + uses : Wandalen/wTools/.github/workflows/standard_rust_push.yml@alpha + with : + manifest_path : 'module/blank/mindx12/Cargo.toml' + module_name : 'mindx12' + commit_message : ${{ github.event.head_commit.message }} + commiter_username: ${{ github.event.head_commit.committer.username }} diff --git a/.github/workflows/module_mingl_push.yml b/.github/workflows/module_mingl_push.yml new file mode 100644 index 0000000000..c6ce82da26 --- /dev/null +++ b/.github/workflows/module_mingl_push.yml @@ -0,0 +1,24 @@ +name : mingl + +on : + push : + branches : + - 'alpha' + - 'beta' + - 'master' + + +env : + CARGO_TERM_COLOR : always + +jobs : + + # mingl + + test : + uses : Wandalen/wTools/.github/workflows/standard_rust_push.yml@alpha + with : + manifest_path : 'module/blank/mingl/Cargo.toml' + module_name : 'mingl' + commit_message : ${{ github.event.head_commit.message }} + commiter_username: ${{ github.event.head_commit.committer.username }} diff --git a/.github/workflows/module_minmetal_push.yml b/.github/workflows/module_minmetal_push.yml new file mode 100644 index 0000000000..e76b7cf916 --- /dev/null +++ b/.github/workflows/module_minmetal_push.yml @@ -0,0 +1,24 @@ +name : minmetal + +on : + push : + branches : + - 'alpha' + - 'beta' + - 'master' + + +env : + CARGO_TERM_COLOR : always + +jobs : + + # minmetal + + test : + uses : Wandalen/wTools/.github/workflows/standard_rust_push.yml@alpha + with : + manifest_path : 'module/blank/minmetal/Cargo.toml' + module_name : 'minmetal' + commit_message : ${{ github.event.head_commit.message }} + commiter_username: ${{ github.event.head_commit.committer.username }} diff --git a/.github/workflows/module_minopengl_push.yml b/.github/workflows/module_minopengl_push.yml new file mode 100644 index 0000000000..5d412de534 --- /dev/null +++ b/.github/workflows/module_minopengl_push.yml @@ -0,0 +1,24 @@ +name : minopengl + +on : + push : + branches : + - 'alpha' + - 'beta' + - 'master' + + +env : + CARGO_TERM_COLOR : always + +jobs : + + # minopengl + + test : + uses : Wandalen/wTools/.github/workflows/standard_rust_push.yml@alpha + with : + manifest_path : 'module/blank/minopengl/Cargo.toml' + module_name : 'minopengl' + commit_message : ${{ github.event.head_commit.message }} + commiter_username: ${{ github.event.head_commit.committer.username }} diff --git a/.github/workflows/module_minvulkan_push.yml b/.github/workflows/module_minvulkan_push.yml new file mode 100644 index 0000000000..1350cf0693 --- /dev/null +++ b/.github/workflows/module_minvulkan_push.yml @@ -0,0 +1,24 @@ +name : minvulkan + +on : + push : + branches : + - 'alpha' + - 'beta' + - 'master' + + +env : + CARGO_TERM_COLOR : always + +jobs : + + # minvulkan + + test : + uses : Wandalen/wTools/.github/workflows/standard_rust_push.yml@alpha + with : + manifest_path : 'module/blank/minvulkan/Cargo.toml' + module_name : 'minvulkan' + commit_message : ${{ github.event.head_commit.message }} + commiter_username: ${{ github.event.head_commit.committer.username }} diff --git a/.github/workflows/module_minwebgl_push.yml b/.github/workflows/module_minwebgl_push.yml new file mode 100644 index 0000000000..4d63735d10 --- /dev/null +++ b/.github/workflows/module_minwebgl_push.yml @@ -0,0 +1,24 @@ +name : minwebgl + +on : + push : + branches : + - 'alpha' + - 'beta' + - 'master' + + +env : + CARGO_TERM_COLOR : always + +jobs : + + # minwebgl + + test : + uses : Wandalen/wTools/.github/workflows/standard_rust_push.yml@alpha + with : + manifest_path : 'module/blank/minwebgl/Cargo.toml' + module_name : 'minwebgl' + commit_message : ${{ github.event.head_commit.message }} + commiter_username: ${{ github.event.head_commit.committer.username }} diff --git a/.github/workflows/module_minwebgpu_push.yml b/.github/workflows/module_minwebgpu_push.yml new file mode 100644 index 0000000000..4e8992613d --- /dev/null +++ b/.github/workflows/module_minwebgpu_push.yml @@ -0,0 +1,24 @@ +name : minwebgpu + +on : + push : + branches : + - 'alpha' + - 'beta' + - 'master' + + +env : + CARGO_TERM_COLOR : always + +jobs : + + # minwebgpu + + test : + uses : Wandalen/wTools/.github/workflows/standard_rust_push.yml@alpha + with : + manifest_path : 'module/blank/minwebgpu/Cargo.toml' + module_name : 'minwebgpu' + commit_message : ${{ github.event.head_commit.message }} + commiter_username: ${{ github.event.head_commit.committer.username }} diff --git a/.github/workflows/module_minwgpu_push.yml b/.github/workflows/module_minwgpu_push.yml new file mode 100644 index 0000000000..382a15d19b --- /dev/null +++ b/.github/workflows/module_minwgpu_push.yml @@ -0,0 +1,24 @@ +name : minwgpu + +on : + push : + branches : + - 'alpha' + - 'beta' + - 'master' + + +env : + CARGO_TERM_COLOR : always + +jobs : + + # minwgpu + + test : + uses : Wandalen/wTools/.github/workflows/standard_rust_push.yml@alpha + with : + manifest_path : 'module/blank/minwgpu/Cargo.toml' + module_name : 'minwgpu' + commit_message : ${{ github.event.head_commit.message }} + commiter_username: ${{ github.event.head_commit.committer.username }} diff --git a/.github/workflows/module_proper_path_tools_push.yml b/.github/workflows/module_proper_path_tools_push.yml index ebfcf83964..238a9cdb3f 100644 --- a/.github/workflows/module_proper_path_tools_push.yml +++ b/.github/workflows/module_proper_path_tools_push.yml @@ -18,7 +18,7 @@ jobs : test : uses : Wandalen/wTools/.github/workflows/standard_rust_push.yml@alpha with : - manifest_path : 'module/core/proper_path_tools/Cargo.toml' + manifest_path : 'module/blank/proper_path_tools/Cargo.toml' module_name : 'proper_path_tools' commit_message : ${{ github.event.head_commit.message }} commiter_username: ${{ github.event.head_commit.committer.username }} diff --git a/.github/workflows/module_pth_push.yml b/.github/workflows/module_pth_push.yml new file mode 100644 index 0000000000..ddff538916 --- /dev/null +++ b/.github/workflows/module_pth_push.yml @@ -0,0 +1,24 @@ +name : pth + +on : + push : + branches : + - 'alpha' + - 'beta' + - 'master' + + +env : + CARGO_TERM_COLOR : always + +jobs : + + # pth + + test : + uses : Wandalen/wTools/.github/workflows/standard_rust_push.yml@alpha + with : + manifest_path : 'module/core/pth/Cargo.toml' + module_name : 'pth' + commit_message : ${{ github.event.head_commit.message }} + commiter_username: ${{ github.event.head_commit.committer.username }} diff --git a/Cargo.toml b/Cargo.toml index ca0d63d237..a940b1b1ec 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -80,7 +80,7 @@ path = "module/alias/std_x" ## data_type [workspace.dependencies.data_type] -version = "~0.10.0" +version = "~0.12.0" path = "module/core/data_type" default-features = false @@ -98,19 +98,19 @@ default-features = false # path = "module/core/type_constructor_derive_pair_meta" [workspace.dependencies.interval_adapter] -version = "~0.25.0" +version = "~0.27.0" path = "module/core/interval_adapter" default-features = false -features = [ "enabled" ] +# features = [ "enabled" ] [workspace.dependencies.winterval] version = "~0.3.0" path = "module/alias/winterval" default-features = false -features = [ "enabled" ] +# features = [ "enabled" ] [workspace.dependencies.collection_tools] -version = "~0.13.0" +version = "~0.15.0" path = "module/core/collection_tools" default-features = false @@ -118,34 +118,34 @@ default-features = false ## derive [workspace.dependencies.derive_tools] -version = "~0.29.0" +version = "~0.32.0" path = "module/core/derive_tools" default-features = false -features = [ "enabled" ] +# features = [ "enabled" ] [workspace.dependencies.derive_tools_meta] -version = "~0.28.0" +version = "~0.31.0" path = "module/core/derive_tools_meta" default-features = false -features = [ "enabled" ] +# features = [ "enabled" ] [workspace.dependencies.reflect_tools] version = "~0.3.0" path = "module/core/reflect_tools" default-features = false -features = [ "enabled" ] +# features = [ "enabled" ] [workspace.dependencies.reflect_tools_meta] version = "~0.3.0" path = "module/core/reflect_tools_meta" default-features = false -features = [ "enabled" ] +# features = [ "enabled" ] [workspace.dependencies.format_tools] version = "~0.2.0" path = "module/core/format_tools" default-features = false -features = [ "enabled" ] +# features = [ "enabled" ] # xxx : remove features, maybe # [workspace.dependencies.type_constructor] @@ -159,33 +159,33 @@ path = "module/alias/fundamental_data_type" default-features = false [workspace.dependencies.variadic_from] -version = "~0.24.0" +version = "~0.27.0" path = "module/core/variadic_from" default-features = false -features = [ "enabled" ] +# features = [ "enabled" ] [workspace.dependencies.clone_dyn] -version = "~0.25.0" +version = "~0.29.0" path = "module/core/clone_dyn" default-features = false -features = [ "enabled" ] +# features = [ "enabled" ] [workspace.dependencies.clone_dyn_meta] -version = "~0.24.0" +version = "~0.27.0" path = "module/core/clone_dyn_meta" -features = [ "enabled" ] +# features = [ "enabled" ] [workspace.dependencies.clone_dyn_types] -version = "~0.24.0" +version = "~0.26.0" path = "module/core/clone_dyn_types" default-features = false -features = [ "enabled" ] +# features = [ "enabled" ] ## mem [workspace.dependencies.mem_tools] -version = "~0.7.0" +version = "~0.8.0" path = "module/core/mem_tools" default-features = false @@ -193,7 +193,7 @@ default-features = false ## diagnostics [workspace.dependencies.diagnostics_tools] -version = "~0.9.0" +version = "~0.10.0" path = "module/core/diagnostics_tools" default-features = false @@ -201,7 +201,7 @@ default-features = false ## iter [workspace.dependencies.iter_tools] -version = "~0.22.0" +version = "~0.24.0" path = "module/core/iter_tools" default-features = false @@ -209,17 +209,17 @@ default-features = false ## meta [workspace.dependencies.meta_tools] -version = "~0.11.0" +version = "~0.12.0" path = "module/core/meta_tools" default-features = false [workspace.dependencies.for_each] -version = "~0.9.0" +version = "~0.10.0" path = "module/core/for_each" default-features = false [workspace.dependencies.former] -version = "~2.9.0" +version = "~2.11.0" path = "module/core/former" default-features = false @@ -229,31 +229,31 @@ default-features = false # default-features = false [workspace.dependencies.former_meta] -version = "~2.9.0" +version = "~2.11.0" path = "module/core/former_meta" default-features = false [workspace.dependencies.former_types] -version = "~2.9.0" +version = "~2.12.0" path = "module/core/former_types" default-features = false [workspace.dependencies.impls_index] -version = "~0.8.0" +version = "~0.9.0" path = "module/core/impls_index" default-features = false [workspace.dependencies.impls_index_meta] -version = "~0.8.0" +version = "~0.9.0" path = "module/core/impls_index_meta" [workspace.dependencies.mod_interface] -version = "~0.27.0" +version = "~0.30.0" path = "module/core/mod_interface" default-features = false [workspace.dependencies.mod_interface_meta] -version = "~0.26.0" +version = "~0.29.0" path = "module/core/mod_interface_meta" default-features = false @@ -279,7 +279,7 @@ default-features = false ## macro tools [workspace.dependencies.macro_tools] -version = "~0.41.0" +version = "~0.44.0" path = "module/core/macro_tools" default-features = false @@ -305,12 +305,12 @@ default-features = false ## typing [workspace.dependencies.typing_tools] -version = "~0.9.0" +version = "~0.10.0" path = "module/core/typing_tools" default-features = false [workspace.dependencies.implements] -version = "~0.9.0" +version = "~0.10.0" path = "module/core/implements" default-features = false @@ -320,12 +320,12 @@ path = "module/alias/instance_of" default-features = false [workspace.dependencies.inspect_type] -version = "~0.11.0" +version = "~0.12.0" path = "module/core/inspect_type" default-features = false [workspace.dependencies.is_slice] -version = "~0.10.0" +version = "~0.11.0" path = "module/core/is_slice" default-features = false @@ -333,7 +333,7 @@ default-features = false ## error [workspace.dependencies.error_tools] -version = "~0.17.0" +version = "~0.19.0" path = "module/core/error_tools" default-features = false @@ -345,7 +345,7 @@ path = "module/alias/werror" ## string tools [workspace.dependencies.strs_tools] -version = "~0.17.0" +version = "~0.18.0" path = "module/core/strs_tools" default-features = false @@ -366,16 +366,21 @@ version = "~0.1.0" path = "module/alias/file_tools" default-features = false -[workspace.dependencies.proper_path_tools] -version = "~0.11.0" -path = "module/core/proper_path_tools" +[workspace.dependencies.pth] +version = "~0.21.0" +path = "module/core/pth" default-features = false +# [workspace.dependencies.proper_path_tools] +# version = "~0.15.0" +# path = "module/core/proper_path_tools" +# default-features = false + ## process tools [workspace.dependencies.process_tools] -version = "~0.10.0" +version = "~0.12.0" path = "module/core/process_tools" default-features = false @@ -392,14 +397,29 @@ version = "~0.4.0" path = "module/alias/wtest" [workspace.dependencies.test_tools] -version = "~0.10.0" +version = "~0.11.0" path = "module/core/test_tools" +features = [ "full" ] + +[workspace.dependencies.test_tools_stable] +package = "test_tools" +version = "~0.10.0" +features = [ "full" ] [workspace.dependencies.wtest_basic] version = "~0.4.0" path = "module/alias/wtest_basic" +## async + +[workspace.dependencies.async_from] +version = "~0.2.0" +path = "module/core/async_from" + +[workspace.dependencies.async_tools] +version = "~0.1.0" +path = "module/core/async_tools" ## graphs tools @@ -422,7 +442,7 @@ default-features = false ## ca [workspace.dependencies.wca] -version = "~0.22.0" +version = "~0.23.0" path = "module/move/wca" @@ -436,7 +456,7 @@ path = "module/move/wcensor" ## willbe [workspace.dependencies.willbe] -version = "~0.19.0" +version = "~0.20.0" path = "module/move/willbe" @@ -476,7 +496,7 @@ version = "~0.5.0" path = "module/move/deterministic_rand" [workspace.dependencies.crates_tools] -version = "~0.13.0" +version = "~0.14.0" path = "module/move/crates_tools" @@ -507,3 +527,13 @@ default-features = true version = "~0.3.0" path = "module/test/c" default-features = true + +## External + +[workspace.dependencies.async-trait] +version = "0.1.83" + +[workspace.dependencies.tokio] +version = "1.41.0" +features = [] +default-features = false \ No newline at end of file diff --git a/Readme.md b/Readme.md index 36612d9970..1dd88d3db6 100644 --- a/Readme.md +++ b/Readme.md @@ -27,31 +27,33 @@ Collection of general purpose tools for solving problems. Fundamentally extend t | [clone_dyn](module/core/clone_dyn) | [![experimental](https://raster.shields.io/static/v1?label=&message=experimental&color=orange)](https://github.com/emersion/stability-badges#experimental) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_clone_dyn_push.yml?label=&branch=master)](https://github.com/Wandalen/wTools/actions/workflows/module_clone_dyn_push.yml?query=branch%3Amaster) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_clone_dyn_push.yml?label=&branch=alpha)](https://github.com/Wandalen/wTools/actions/workflows/module_clone_dyn_push.yml?query=branch%3Aalpha) | [![docs.rs](https://raster.shields.io/static/v1?label=&message=docs&color=eee)](https://docs.rs/clone_dyn) | [![Open in Gitpod](https://raster.shields.io/static/v1?label=&message=try&color=eee)](https://gitpod.io/#RUN_PATH=.,SAMPLE_FILE=module%2Fcore%2Fclone_dyn%2Fexamples%2Fclone_dyn_trivial.rs,RUN_POSTFIX=--example%20clone_dyn_trivial/https://github.com/Wandalen/wTools) | | [variadic_from](module/core/variadic_from) | [![experimental](https://raster.shields.io/static/v1?label=&message=experimental&color=orange)](https://github.com/emersion/stability-badges#experimental) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_variadic_from_push.yml?label=&branch=master)](https://github.com/Wandalen/wTools/actions/workflows/module_variadic_from_push.yml?query=branch%3Amaster) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_variadic_from_push.yml?label=&branch=alpha)](https://github.com/Wandalen/wTools/actions/workflows/module_variadic_from_push.yml?query=branch%3Aalpha) | [![docs.rs](https://raster.shields.io/static/v1?label=&message=docs&color=eee)](https://docs.rs/variadic_from) | [![Open in Gitpod](https://raster.shields.io/static/v1?label=&message=try&color=eee)](https://gitpod.io/#RUN_PATH=.,SAMPLE_FILE=module%2Fcore%2Fvariadic_from%2Fexamples%2Fvariadic_from_trivial.rs,RUN_POSTFIX=--example%20variadic_from_trivial/https://github.com/Wandalen/wTools) | | [derive_tools](module/core/derive_tools) | [![experimental](https://raster.shields.io/static/v1?label=&message=experimental&color=orange)](https://github.com/emersion/stability-badges#experimental) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_derive_tools_push.yml?label=&branch=master)](https://github.com/Wandalen/wTools/actions/workflows/module_derive_tools_push.yml?query=branch%3Amaster) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_derive_tools_push.yml?label=&branch=alpha)](https://github.com/Wandalen/wTools/actions/workflows/module_derive_tools_push.yml?query=branch%3Aalpha) | [![docs.rs](https://raster.shields.io/static/v1?label=&message=docs&color=eee)](https://docs.rs/derive_tools) | [![Open in Gitpod](https://raster.shields.io/static/v1?label=&message=try&color=eee)](https://gitpod.io/#RUN_PATH=.,SAMPLE_FILE=module%2Fcore%2Fderive_tools%2Fexamples%2Fderive_tools_trivial.rs,RUN_POSTFIX=--example%20derive_tools_trivial/https://github.com/Wandalen/wTools) | +| [mod_interface_meta](module/core/mod_interface_meta) | [![experimental](https://raster.shields.io/static/v1?label=&message=experimental&color=orange)](https://github.com/emersion/stability-badges#experimental) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_mod_interface_meta_push.yml?label=&branch=master)](https://github.com/Wandalen/wTools/actions/workflows/module_mod_interface_meta_push.yml?query=branch%3Amaster) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_mod_interface_meta_push.yml?label=&branch=alpha)](https://github.com/Wandalen/wTools/actions/workflows/module_mod_interface_meta_push.yml?query=branch%3Aalpha) | [![docs.rs](https://raster.shields.io/static/v1?label=&message=docs&color=eee)](https://docs.rs/mod_interface_meta) | | | [former_meta](module/core/former_meta) | [![experimental](https://raster.shields.io/static/v1?label=&message=experimental&color=orange)](https://github.com/emersion/stability-badges#experimental) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_former_meta_push.yml?label=&branch=master)](https://github.com/Wandalen/wTools/actions/workflows/module_former_meta_push.yml?query=branch%3Amaster) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_former_meta_push.yml?label=&branch=alpha)](https://github.com/Wandalen/wTools/actions/workflows/module_former_meta_push.yml?query=branch%3Aalpha) | [![docs.rs](https://raster.shields.io/static/v1?label=&message=docs&color=eee)](https://docs.rs/former_meta) | | | [impls_index_meta](module/core/impls_index_meta) | [![experimental](https://raster.shields.io/static/v1?label=&message=experimental&color=orange)](https://github.com/emersion/stability-badges#experimental) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_impls_index_meta_push.yml?label=&branch=master)](https://github.com/Wandalen/wTools/actions/workflows/module_impls_index_meta_push.yml?query=branch%3Amaster) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_impls_index_meta_push.yml?label=&branch=alpha)](https://github.com/Wandalen/wTools/actions/workflows/module_impls_index_meta_push.yml?query=branch%3Aalpha) | [![docs.rs](https://raster.shields.io/static/v1?label=&message=docs&color=eee)](https://docs.rs/impls_index_meta) | | -| [mod_interface_meta](module/core/mod_interface_meta) | [![experimental](https://raster.shields.io/static/v1?label=&message=experimental&color=orange)](https://github.com/emersion/stability-badges#experimental) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_mod_interface_meta_push.yml?label=&branch=master)](https://github.com/Wandalen/wTools/actions/workflows/module_mod_interface_meta_push.yml?query=branch%3Amaster) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_mod_interface_meta_push.yml?label=&branch=alpha)](https://github.com/Wandalen/wTools/actions/workflows/module_mod_interface_meta_push.yml?query=branch%3Aalpha) | [![docs.rs](https://raster.shields.io/static/v1?label=&message=docs&color=eee)](https://docs.rs/mod_interface_meta) | | +| [mod_interface](module/core/mod_interface) | [![experimental](https://raster.shields.io/static/v1?label=&message=experimental&color=orange)](https://github.com/emersion/stability-badges#experimental) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_mod_interface_push.yml?label=&branch=master)](https://github.com/Wandalen/wTools/actions/workflows/module_mod_interface_push.yml?query=branch%3Amaster) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_mod_interface_push.yml?label=&branch=alpha)](https://github.com/Wandalen/wTools/actions/workflows/module_mod_interface_push.yml?query=branch%3Aalpha) | [![docs.rs](https://raster.shields.io/static/v1?label=&message=docs&color=eee)](https://docs.rs/mod_interface) | | +| [error_tools](module/core/error_tools) | [![experimental](https://raster.shields.io/static/v1?label=&message=experimental&color=orange)](https://github.com/emersion/stability-badges#experimental) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_error_tools_push.yml?label=&branch=master)](https://github.com/Wandalen/wTools/actions/workflows/module_error_tools_push.yml?query=branch%3Amaster) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_error_tools_push.yml?label=&branch=alpha)](https://github.com/Wandalen/wTools/actions/workflows/module_error_tools_push.yml?query=branch%3Aalpha) | [![docs.rs](https://raster.shields.io/static/v1?label=&message=docs&color=eee)](https://docs.rs/error_tools) | [![Open in Gitpod](https://raster.shields.io/static/v1?label=&message=try&color=eee)](https://gitpod.io/#RUN_PATH=.,SAMPLE_FILE=module%2Fcore%2Ferror_tools%2Fexamples%2Ferror_tools_trivial.rs,RUN_POSTFIX=--example%20error_tools_trivial/https://github.com/Wandalen/wTools) | | [for_each](module/core/for_each) | [![experimental](https://raster.shields.io/static/v1?label=&message=experimental&color=orange)](https://github.com/emersion/stability-badges#experimental) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_for_each_push.yml?label=&branch=master)](https://github.com/Wandalen/wTools/actions/workflows/module_for_each_push.yml?query=branch%3Amaster) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_for_each_push.yml?label=&branch=alpha)](https://github.com/Wandalen/wTools/actions/workflows/module_for_each_push.yml?query=branch%3Aalpha) | [![docs.rs](https://raster.shields.io/static/v1?label=&message=docs&color=eee)](https://docs.rs/for_each) | [![Open in Gitpod](https://raster.shields.io/static/v1?label=&message=try&color=eee)](https://gitpod.io/#RUN_PATH=.,SAMPLE_FILE=module%2Fcore%2Ffor_each%2Fexamples%2Ffor_each_trivial.rs,RUN_POSTFIX=--example%20for_each_trivial/https://github.com/Wandalen/wTools) | | [former](module/core/former) | [![experimental](https://raster.shields.io/static/v1?label=&message=experimental&color=orange)](https://github.com/emersion/stability-badges#experimental) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_former_push.yml?label=&branch=master)](https://github.com/Wandalen/wTools/actions/workflows/module_former_push.yml?query=branch%3Amaster) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_former_push.yml?label=&branch=alpha)](https://github.com/Wandalen/wTools/actions/workflows/module_former_push.yml?query=branch%3Aalpha) | [![docs.rs](https://raster.shields.io/static/v1?label=&message=docs&color=eee)](https://docs.rs/former) | [![Open in Gitpod](https://raster.shields.io/static/v1?label=&message=try&color=eee)](https://gitpod.io/#RUN_PATH=.,SAMPLE_FILE=module%2Fcore%2Fformer%2Fexamples%2Fformer_trivial.rs,RUN_POSTFIX=--example%20former_trivial/https://github.com/Wandalen/wTools) | | [implements](module/core/implements) | [![experimental](https://raster.shields.io/static/v1?label=&message=experimental&color=orange)](https://github.com/emersion/stability-badges#experimental) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_implements_push.yml?label=&branch=master)](https://github.com/Wandalen/wTools/actions/workflows/module_implements_push.yml?query=branch%3Amaster) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_implements_push.yml?label=&branch=alpha)](https://github.com/Wandalen/wTools/actions/workflows/module_implements_push.yml?query=branch%3Aalpha) | [![docs.rs](https://raster.shields.io/static/v1?label=&message=docs&color=eee)](https://docs.rs/implements) | [![Open in Gitpod](https://raster.shields.io/static/v1?label=&message=try&color=eee)](https://gitpod.io/#RUN_PATH=.,SAMPLE_FILE=module%2Fcore%2Fimplements%2Fexamples%2Fimplements_trivial.rs,RUN_POSTFIX=--example%20implements_trivial/https://github.com/Wandalen/wTools) | | [impls_index](module/core/impls_index) | [![experimental](https://raster.shields.io/static/v1?label=&message=experimental&color=orange)](https://github.com/emersion/stability-badges#experimental) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_impls_index_push.yml?label=&branch=master)](https://github.com/Wandalen/wTools/actions/workflows/module_impls_index_push.yml?query=branch%3Amaster) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_impls_index_push.yml?label=&branch=alpha)](https://github.com/Wandalen/wTools/actions/workflows/module_impls_index_push.yml?query=branch%3Aalpha) | [![docs.rs](https://raster.shields.io/static/v1?label=&message=docs&color=eee)](https://docs.rs/impls_index) | [![Open in Gitpod](https://raster.shields.io/static/v1?label=&message=try&color=eee)](https://gitpod.io/#RUN_PATH=.,SAMPLE_FILE=module%2Fcore%2Fimpls_index%2Fexamples%2Fimpls_index_trivial.rs,RUN_POSTFIX=--example%20impls_index_trivial/https://github.com/Wandalen/wTools) | | [inspect_type](module/core/inspect_type) | [![experimental](https://raster.shields.io/static/v1?label=&message=experimental&color=orange)](https://github.com/emersion/stability-badges#experimental) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_inspect_type_push.yml?label=&branch=master)](https://github.com/Wandalen/wTools/actions/workflows/module_inspect_type_push.yml?query=branch%3Amaster) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_inspect_type_push.yml?label=&branch=alpha)](https://github.com/Wandalen/wTools/actions/workflows/module_inspect_type_push.yml?query=branch%3Aalpha) | [![docs.rs](https://raster.shields.io/static/v1?label=&message=docs&color=eee)](https://docs.rs/inspect_type) | [![Open in Gitpod](https://raster.shields.io/static/v1?label=&message=try&color=eee)](https://gitpod.io/#RUN_PATH=.,SAMPLE_FILE=module%2Fcore%2Finspect_type%2Fexamples%2Finspect_type_trivial.rs,RUN_POSTFIX=--example%20inspect_type_trivial/https://github.com/Wandalen/wTools) | | [is_slice](module/core/is_slice) | [![experimental](https://raster.shields.io/static/v1?label=&message=experimental&color=orange)](https://github.com/emersion/stability-badges#experimental) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_is_slice_push.yml?label=&branch=master)](https://github.com/Wandalen/wTools/actions/workflows/module_is_slice_push.yml?query=branch%3Amaster) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_is_slice_push.yml?label=&branch=alpha)](https://github.com/Wandalen/wTools/actions/workflows/module_is_slice_push.yml?query=branch%3Aalpha) | [![docs.rs](https://raster.shields.io/static/v1?label=&message=docs&color=eee)](https://docs.rs/is_slice) | [![Open in Gitpod](https://raster.shields.io/static/v1?label=&message=try&color=eee)](https://gitpod.io/#RUN_PATH=.,SAMPLE_FILE=module%2Fcore%2Fis_slice%2Fexamples%2Fis_slice_trivial.rs,RUN_POSTFIX=--example%20is_slice_trivial/https://github.com/Wandalen/wTools) | -| [mod_interface](module/core/mod_interface) | [![experimental](https://raster.shields.io/static/v1?label=&message=experimental&color=orange)](https://github.com/emersion/stability-badges#experimental) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_mod_interface_push.yml?label=&branch=master)](https://github.com/Wandalen/wTools/actions/workflows/module_mod_interface_push.yml?query=branch%3Amaster) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_mod_interface_push.yml?label=&branch=alpha)](https://github.com/Wandalen/wTools/actions/workflows/module_mod_interface_push.yml?query=branch%3Aalpha) | [![docs.rs](https://raster.shields.io/static/v1?label=&message=docs&color=eee)](https://docs.rs/mod_interface) | | +| [pth](module/core/pth) | [![experimental](https://raster.shields.io/static/v1?label=&message=experimental&color=orange)](https://github.com/emersion/stability-badges#experimental) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_pth_push.yml?label=&branch=master)](https://github.com/Wandalen/wTools/actions/workflows/module_pth_push.yml?query=branch%3Amaster) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_pth_push.yml?label=&branch=alpha)](https://github.com/Wandalen/wTools/actions/workflows/module_pth_push.yml?query=branch%3Aalpha) | [![docs.rs](https://raster.shields.io/static/v1?label=&message=docs&color=eee)](https://docs.rs/pth) | | | [reflect_tools_meta](module/core/reflect_tools_meta) | [![experimental](https://raster.shields.io/static/v1?label=&message=experimental&color=orange)](https://github.com/emersion/stability-badges#experimental) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_reflect_tools_meta_push.yml?label=&branch=master)](https://github.com/Wandalen/wTools/actions/workflows/module_reflect_tools_meta_push.yml?query=branch%3Amaster) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_reflect_tools_meta_push.yml?label=&branch=alpha)](https://github.com/Wandalen/wTools/actions/workflows/module_reflect_tools_meta_push.yml?query=branch%3Aalpha) | [![docs.rs](https://raster.shields.io/static/v1?label=&message=docs&color=eee)](https://docs.rs/reflect_tools_meta) | | | [data_type](module/core/data_type) | [![experimental](https://raster.shields.io/static/v1?label=&message=experimental&color=orange)](https://github.com/emersion/stability-badges#experimental) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_data_type_push.yml?label=&branch=master)](https://github.com/Wandalen/wTools/actions/workflows/module_data_type_push.yml?query=branch%3Amaster) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_data_type_push.yml?label=&branch=alpha)](https://github.com/Wandalen/wTools/actions/workflows/module_data_type_push.yml?query=branch%3Aalpha) | [![docs.rs](https://raster.shields.io/static/v1?label=&message=docs&color=eee)](https://docs.rs/data_type) | [![Open in Gitpod](https://raster.shields.io/static/v1?label=&message=try&color=eee)](https://gitpod.io/#RUN_PATH=.,SAMPLE_FILE=module%2Fcore%2Fdata_type%2Fexamples%2Fdata_type_trivial.rs,RUN_POSTFIX=--example%20data_type_trivial/https://github.com/Wandalen/wTools) | | [diagnostics_tools](module/core/diagnostics_tools) | [![experimental](https://raster.shields.io/static/v1?label=&message=experimental&color=orange)](https://github.com/emersion/stability-badges#experimental) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_diagnostics_tools_push.yml?label=&branch=master)](https://github.com/Wandalen/wTools/actions/workflows/module_diagnostics_tools_push.yml?query=branch%3Amaster) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_diagnostics_tools_push.yml?label=&branch=alpha)](https://github.com/Wandalen/wTools/actions/workflows/module_diagnostics_tools_push.yml?query=branch%3Aalpha) | [![docs.rs](https://raster.shields.io/static/v1?label=&message=docs&color=eee)](https://docs.rs/diagnostics_tools) | [![Open in Gitpod](https://raster.shields.io/static/v1?label=&message=try&color=eee)](https://gitpod.io/#RUN_PATH=.,SAMPLE_FILE=module%2Fcore%2Fdiagnostics_tools%2Fexamples%2Fdiagnostics_tools_trivial.rs,RUN_POSTFIX=--example%20diagnostics_tools_trivial/https://github.com/Wandalen/wTools) | -| [error_tools](module/core/error_tools) | [![experimental](https://raster.shields.io/static/v1?label=&message=experimental&color=orange)](https://github.com/emersion/stability-badges#experimental) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_error_tools_push.yml?label=&branch=master)](https://github.com/Wandalen/wTools/actions/workflows/module_error_tools_push.yml?query=branch%3Amaster) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_error_tools_push.yml?label=&branch=alpha)](https://github.com/Wandalen/wTools/actions/workflows/module_error_tools_push.yml?query=branch%3Aalpha) | [![docs.rs](https://raster.shields.io/static/v1?label=&message=docs&color=eee)](https://docs.rs/error_tools) | [![Open in Gitpod](https://raster.shields.io/static/v1?label=&message=try&color=eee)](https://gitpod.io/#RUN_PATH=.,SAMPLE_FILE=module%2Fcore%2Ferror_tools%2Fexamples%2Ferror_tools_trivial.rs,RUN_POSTFIX=--example%20error_tools_trivial/https://github.com/Wandalen/wTools) | | [mem_tools](module/core/mem_tools) | [![experimental](https://raster.shields.io/static/v1?label=&message=experimental&color=orange)](https://github.com/emersion/stability-badges#experimental) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_mem_tools_push.yml?label=&branch=master)](https://github.com/Wandalen/wTools/actions/workflows/module_mem_tools_push.yml?query=branch%3Amaster) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_mem_tools_push.yml?label=&branch=alpha)](https://github.com/Wandalen/wTools/actions/workflows/module_mem_tools_push.yml?query=branch%3Aalpha) | [![docs.rs](https://raster.shields.io/static/v1?label=&message=docs&color=eee)](https://docs.rs/mem_tools) | [![Open in Gitpod](https://raster.shields.io/static/v1?label=&message=try&color=eee)](https://gitpod.io/#RUN_PATH=.,SAMPLE_FILE=module%2Fcore%2Fmem_tools%2Fexamples%2Fmem_tools_trivial.rs,RUN_POSTFIX=--example%20mem_tools_trivial/https://github.com/Wandalen/wTools) | | [meta_tools](module/core/meta_tools) | [![experimental](https://raster.shields.io/static/v1?label=&message=experimental&color=orange)](https://github.com/emersion/stability-badges#experimental) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_meta_tools_push.yml?label=&branch=master)](https://github.com/Wandalen/wTools/actions/workflows/module_meta_tools_push.yml?query=branch%3Amaster) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_meta_tools_push.yml?label=&branch=alpha)](https://github.com/Wandalen/wTools/actions/workflows/module_meta_tools_push.yml?query=branch%3Aalpha) | [![docs.rs](https://raster.shields.io/static/v1?label=&message=docs&color=eee)](https://docs.rs/meta_tools) | [![Open in Gitpod](https://raster.shields.io/static/v1?label=&message=try&color=eee)](https://gitpod.io/#RUN_PATH=.,SAMPLE_FILE=module%2Fcore%2Fmeta_tools%2Fexamples%2Fmeta_tools_trivial.rs,RUN_POSTFIX=--example%20meta_tools_trivial/https://github.com/Wandalen/wTools) | -| [proper_path_tools](module/core/proper_path_tools) | [![experimental](https://raster.shields.io/static/v1?label=&message=experimental&color=orange)](https://github.com/emersion/stability-badges#experimental) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_proper_path_tools_push.yml?label=&branch=master)](https://github.com/Wandalen/wTools/actions/workflows/module_proper_path_tools_push.yml?query=branch%3Amaster) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_proper_path_tools_push.yml?label=&branch=alpha)](https://github.com/Wandalen/wTools/actions/workflows/module_proper_path_tools_push.yml?query=branch%3Aalpha) | [![docs.rs](https://raster.shields.io/static/v1?label=&message=docs&color=eee)](https://docs.rs/proper_path_tools) | | +| [process_tools](module/core/process_tools) | [![experimental](https://raster.shields.io/static/v1?label=&message=experimental&color=orange)](https://github.com/emersion/stability-badges#experimental) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_process_tools_push.yml?label=&branch=master)](https://github.com/Wandalen/wTools/actions/workflows/module_process_tools_push.yml?query=branch%3Amaster) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_process_tools_push.yml?label=&branch=alpha)](https://github.com/Wandalen/wTools/actions/workflows/module_process_tools_push.yml?query=branch%3Aalpha) | [![docs.rs](https://raster.shields.io/static/v1?label=&message=docs&color=eee)](https://docs.rs/process_tools) | | | [reflect_tools](module/core/reflect_tools) | [![experimental](https://raster.shields.io/static/v1?label=&message=experimental&color=orange)](https://github.com/emersion/stability-badges#experimental) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_reflect_tools_push.yml?label=&branch=master)](https://github.com/Wandalen/wTools/actions/workflows/module_reflect_tools_push.yml?query=branch%3Amaster) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_reflect_tools_push.yml?label=&branch=alpha)](https://github.com/Wandalen/wTools/actions/workflows/module_reflect_tools_push.yml?query=branch%3Aalpha) | [![docs.rs](https://raster.shields.io/static/v1?label=&message=docs&color=eee)](https://docs.rs/reflect_tools) | [![Open in Gitpod](https://raster.shields.io/static/v1?label=&message=try&color=eee)](https://gitpod.io/#RUN_PATH=.,SAMPLE_FILE=module%2Fcore%2Freflect_tools%2Fexamples%2Freflect_tools_trivial.rs,RUN_POSTFIX=--example%20reflect_tools_trivial/https://github.com/Wandalen/wTools) | | [strs_tools](module/core/strs_tools) | [![experimental](https://raster.shields.io/static/v1?label=&message=experimental&color=orange)](https://github.com/emersion/stability-badges#experimental) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_strs_tools_push.yml?label=&branch=master)](https://github.com/Wandalen/wTools/actions/workflows/module_strs_tools_push.yml?query=branch%3Amaster) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_strs_tools_push.yml?label=&branch=alpha)](https://github.com/Wandalen/wTools/actions/workflows/module_strs_tools_push.yml?query=branch%3Aalpha) | [![docs.rs](https://raster.shields.io/static/v1?label=&message=docs&color=eee)](https://docs.rs/strs_tools) | [![Open in Gitpod](https://raster.shields.io/static/v1?label=&message=try&color=eee)](https://gitpod.io/#RUN_PATH=.,SAMPLE_FILE=module%2Fcore%2Fstrs_tools%2Fexamples%2Fstrs_tools_trivial.rs,RUN_POSTFIX=--example%20strs_tools_trivial/https://github.com/Wandalen/wTools) | | [time_tools](module/core/time_tools) | [![experimental](https://raster.shields.io/static/v1?label=&message=experimental&color=orange)](https://github.com/emersion/stability-badges#experimental) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_time_tools_push.yml?label=&branch=master)](https://github.com/Wandalen/wTools/actions/workflows/module_time_tools_push.yml?query=branch%3Amaster) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_time_tools_push.yml?label=&branch=alpha)](https://github.com/Wandalen/wTools/actions/workflows/module_time_tools_push.yml?query=branch%3Aalpha) | [![docs.rs](https://raster.shields.io/static/v1?label=&message=docs&color=eee)](https://docs.rs/time_tools) | [![Open in Gitpod](https://raster.shields.io/static/v1?label=&message=try&color=eee)](https://gitpod.io/#RUN_PATH=.,SAMPLE_FILE=module%2Fcore%2Ftime_tools%2Fexamples%2Ftime_tools_trivial.rs,RUN_POSTFIX=--example%20time_tools_trivial/https://github.com/Wandalen/wTools) | | [typing_tools](module/core/typing_tools) | [![experimental](https://raster.shields.io/static/v1?label=&message=experimental&color=orange)](https://github.com/emersion/stability-badges#experimental) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_typing_tools_push.yml?label=&branch=master)](https://github.com/Wandalen/wTools/actions/workflows/module_typing_tools_push.yml?query=branch%3Amaster) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_typing_tools_push.yml?label=&branch=alpha)](https://github.com/Wandalen/wTools/actions/workflows/module_typing_tools_push.yml?query=branch%3Aalpha) | [![docs.rs](https://raster.shields.io/static/v1?label=&message=docs&color=eee)](https://docs.rs/typing_tools) | [![Open in Gitpod](https://raster.shields.io/static/v1?label=&message=try&color=eee)](https://gitpod.io/#RUN_PATH=.,SAMPLE_FILE=module%2Fcore%2Ftyping_tools%2Fexamples%2Ftyping_tools_trivial.rs,RUN_POSTFIX=--example%20typing_tools_trivial/https://github.com/Wandalen/wTools) | +| [async_from](module/core/async_from) | [![experimental](https://raster.shields.io/static/v1?label=&message=experimental&color=orange)](https://github.com/emersion/stability-badges#experimental) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_async_from_push.yml?label=&branch=master)](https://github.com/Wandalen/wTools/actions/workflows/module_async_from_push.yml?query=branch%3Amaster) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_async_from_push.yml?label=&branch=alpha)](https://github.com/Wandalen/wTools/actions/workflows/module_async_from_push.yml?query=branch%3Aalpha) | [![docs.rs](https://raster.shields.io/static/v1?label=&message=docs&color=eee)](https://docs.rs/async_from) | | +| [async_tools](module/core/async_tools) | [![experimental](https://raster.shields.io/static/v1?label=&message=experimental&color=orange)](https://github.com/emersion/stability-badges#experimental) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_async_tools_push.yml?label=&branch=master)](https://github.com/Wandalen/wTools/actions/workflows/module_async_tools_push.yml?query=branch%3Amaster) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_async_tools_push.yml?label=&branch=alpha)](https://github.com/Wandalen/wTools/actions/workflows/module_async_tools_push.yml?query=branch%3Aalpha) | [![docs.rs](https://raster.shields.io/static/v1?label=&message=docs&color=eee)](https://docs.rs/async_tools) | | | [format_tools](module/core/format_tools) | [![experimental](https://raster.shields.io/static/v1?label=&message=experimental&color=orange)](https://github.com/emersion/stability-badges#experimental) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_format_tools_push.yml?label=&branch=master)](https://github.com/Wandalen/wTools/actions/workflows/module_format_tools_push.yml?query=branch%3Amaster) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_format_tools_push.yml?label=&branch=alpha)](https://github.com/Wandalen/wTools/actions/workflows/module_format_tools_push.yml?query=branch%3Aalpha) | [![docs.rs](https://raster.shields.io/static/v1?label=&message=docs&color=eee)](https://docs.rs/format_tools) | [![Open in Gitpod](https://raster.shields.io/static/v1?label=&message=try&color=eee)](https://gitpod.io/#RUN_PATH=.,SAMPLE_FILE=module%2Fcore%2Fformat_tools%2Fexamples%2Fformat_tools_trivial.rs,RUN_POSTFIX=--example%20format_tools_trivial/https://github.com/Wandalen/wTools) | | [fs_tools](module/core/fs_tools) | [![experimental](https://raster.shields.io/static/v1?label=&message=experimental&color=orange)](https://github.com/emersion/stability-badges#experimental) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_fs_tools_push.yml?label=&branch=master)](https://github.com/Wandalen/wTools/actions/workflows/module_fs_tools_push.yml?query=branch%3Amaster) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_fs_tools_push.yml?label=&branch=alpha)](https://github.com/Wandalen/wTools/actions/workflows/module_fs_tools_push.yml?query=branch%3Aalpha) | [![docs.rs](https://raster.shields.io/static/v1?label=&message=docs&color=eee)](https://docs.rs/fs_tools) | | | [include_md](module/core/include_md) | [![experimental](https://raster.shields.io/static/v1?label=&message=experimental&color=orange)](https://github.com/emersion/stability-badges#experimental) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_include_md_push.yml?label=&branch=master)](https://github.com/Wandalen/wTools/actions/workflows/module_include_md_push.yml?query=branch%3Amaster) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_include_md_push.yml?label=&branch=alpha)](https://github.com/Wandalen/wTools/actions/workflows/module_include_md_push.yml?query=branch%3Aalpha) | [![docs.rs](https://raster.shields.io/static/v1?label=&message=docs&color=eee)](https://docs.rs/include_md) | | -| [process_tools](module/core/process_tools) | [![experimental](https://raster.shields.io/static/v1?label=&message=experimental&color=orange)](https://github.com/emersion/stability-badges#experimental) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_process_tools_push.yml?label=&branch=master)](https://github.com/Wandalen/wTools/actions/workflows/module_process_tools_push.yml?query=branch%3Amaster) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_process_tools_push.yml?label=&branch=alpha)](https://github.com/Wandalen/wTools/actions/workflows/module_process_tools_push.yml?query=branch%3Aalpha) | [![docs.rs](https://raster.shields.io/static/v1?label=&message=docs&color=eee)](https://docs.rs/process_tools) | | | [program_tools](module/core/program_tools) | [![experimental](https://raster.shields.io/static/v1?label=&message=experimental&color=orange)](https://github.com/emersion/stability-badges#experimental) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_program_tools_push.yml?label=&branch=master)](https://github.com/Wandalen/wTools/actions/workflows/module_program_tools_push.yml?query=branch%3Amaster) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_program_tools_push.yml?label=&branch=alpha)](https://github.com/Wandalen/wTools/actions/workflows/module_program_tools_push.yml?query=branch%3Aalpha) | [![docs.rs](https://raster.shields.io/static/v1?label=&message=docs&color=eee)](https://docs.rs/program_tools) | | | [test_tools](module/core/test_tools) | [![experimental](https://raster.shields.io/static/v1?label=&message=experimental&color=orange)](https://github.com/emersion/stability-badges#experimental) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_test_tools_push.yml?label=&branch=master)](https://github.com/Wandalen/wTools/actions/workflows/module_test_tools_push.yml?query=branch%3Amaster) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_test_tools_push.yml?label=&branch=alpha)](https://github.com/Wandalen/wTools/actions/workflows/module_test_tools_push.yml?query=branch%3Aalpha) | [![docs.rs](https://raster.shields.io/static/v1?label=&message=docs&color=eee)](https://docs.rs/test_tools) | [![Open in Gitpod](https://raster.shields.io/static/v1?label=&message=try&color=eee)](https://gitpod.io/#RUN_PATH=.,SAMPLE_FILE=module%2Fcore%2Ftest_tools%2Fexamples%2Ftest_tools_trivial.rs,RUN_POSTFIX=--example%20test_tools_trivial/https://github.com/Wandalen/wTools) | | [wtools](module/core/wtools) | [![experimental](https://raster.shields.io/static/v1?label=&message=experimental&color=orange)](https://github.com/emersion/stability-badges#experimental) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_wtools_push.yml?label=&branch=master)](https://github.com/Wandalen/wTools/actions/workflows/module_wtools_push.yml?query=branch%3Amaster) | [![rust-status](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/module_wtools_push.yml?label=&branch=alpha)](https://github.com/Wandalen/wTools/actions/workflows/module_wtools_push.yml?query=branch%3Aalpha) | [![docs.rs](https://raster.shields.io/static/v1?label=&message=docs&color=eee)](https://docs.rs/wtools) | [![Open in Gitpod](https://raster.shields.io/static/v1?label=&message=try&color=eee)](https://gitpod.io/#RUN_PATH=.,SAMPLE_FILE=module%2Fcore%2Fwtools%2Fexamples%2Fwtools_trivial.rs,RUN_POSTFIX=--example%20wtools_trivial/https://github.com/Wandalen/wTools) | diff --git a/module/alias/wtest_basic/Cargo.toml b/module/alias/wtest_basic/Cargo.toml index 3d5e3d1218..6e6ceb65fd 100644 --- a/module/alias/wtest_basic/Cargo.toml +++ b/module/alias/wtest_basic/Cargo.toml @@ -58,7 +58,7 @@ enabled = [ "test_tools/enabled" ] [dependencies] -test_tools = { workspace = true, features = [ "full" ] } +test_tools = { workspace = true, default-features = true } # ## external # @@ -76,5 +76,5 @@ test_tools = { workspace = true, features = [ "full" ] } # data_type = { workspace = true, features = [ "full" ] } # diagnostics_tools = { workspace = true, features = [ "full" ] } -# [dev-dependencies] -# test_tools = { workspace = true } +[dev-dependencies] +test_tools = { workspace = true } diff --git a/module/blank/proper_path_tools/Cargo.toml b/module/blank/proper_path_tools/Cargo.toml new file mode 100644 index 0000000000..4fe862c57e --- /dev/null +++ b/module/blank/proper_path_tools/Cargo.toml @@ -0,0 +1,34 @@ +[package] +name = "proper_path_tools" +version = "0.1.0" +edition = "2021" +authors = [ + "Kostiantyn Wandalen ", +] +license = "MIT" +readme = "Readme.md" +documentation = "https://docs.rs/proper_path_tools" +repository = "https://github.com/Wandalen/wTools/tree/master/module/core/proper_path_tools" +homepage = "https://github.com/Wandalen/wTools/tree/master/module/core/proper_path_tools" +description = """ +Tools for second brain. +""" +categories = [ "algorithms", "development-tools" ] +keywords = [ "fundamental", "general-purpose" ] + +[lints] +workspace = true + +[package.metadata.docs.rs] +features = [ "full" ] +all-features = false + +[features] +default = [ "enabled" ] +full = [ "enabled" ] +enabled = [] + +[dependencies] + +[dev-dependencies] +test_tools = { workspace = true } diff --git a/module/core/proper_path_tools/License b/module/blank/proper_path_tools/License similarity index 100% rename from module/core/proper_path_tools/License rename to module/blank/proper_path_tools/License diff --git a/module/blank/proper_path_tools/Readme.md b/module/blank/proper_path_tools/Readme.md new file mode 100644 index 0000000000..7fd9f99168 --- /dev/null +++ b/module/blank/proper_path_tools/Readme.md @@ -0,0 +1,33 @@ + + +# Module :: proper_path_tools +[![experimental](https://raster.shields.io/static/v1?label=stability&message=experimental&color=orange&logoColor=eee)](https://github.com/emersion/stability-badges#experimental) [![rust-status](https://github.com/Wandalen/wTools/actions/workflows/Moduleproper_path_toolsPush.yml/badge.svg)](https://github.com/Wandalen/wTools/actions/workflows/Moduleproper_path_toolsPush.yml) [![docs.rs](https://img.shields.io/docsrs/proper_path_tools?color=e3e8f0&logo=docs.rs)](https://docs.rs/proper_path_tools) [![discord](https://img.shields.io/discord/872391416519737405?color=eee&logo=discord&logoColor=eee&label=ask)](https://discord.gg/m3YfbXpUUY) + +Tools for second brain. + + diff --git a/module/blank/proper_path_tools/src/lib.rs b/module/blank/proper_path_tools/src/lib.rs new file mode 100644 index 0000000000..b96a03ed21 --- /dev/null +++ b/module/blank/proper_path_tools/src/lib.rs @@ -0,0 +1,11 @@ + +#![ doc( html_logo_url = "https://raw.githubusercontent.com/Wandalen/wTools/master/asset/img/logo_v3_trans_square.png" ) ] +#![ doc( html_favicon_url = "https://raw.githubusercontent.com/Wandalen/wTools/alpha/asset/img/logo_v3_trans_square_icon_small_v2.ico" ) ] +#![ doc( html_root_url = "https://docs.rs/proper_path_tools/latest/proper_path_tools/" ) ] +#![ doc = include_str!( concat!( env!( "CARGO_MANIFEST_DIR" ), "/", "Readme.md" ) ) ] + +/// Function description. +#[ cfg( feature = "enabled" ) ] +pub fn f1() +{ +} diff --git a/module/blank/proper_path_tools/tests/inc/basic_test.rs b/module/blank/proper_path_tools/tests/inc/basic_test.rs new file mode 100644 index 0000000000..60c9a81cfb --- /dev/null +++ b/module/blank/proper_path_tools/tests/inc/basic_test.rs @@ -0,0 +1,7 @@ +#[ allow( unused_imports ) ] +use super::*; + +#[ test ] +fn basic() +{ +} diff --git a/module/blank/proper_path_tools/tests/inc/mod.rs b/module/blank/proper_path_tools/tests/inc/mod.rs new file mode 100644 index 0000000000..dde9de6f94 --- /dev/null +++ b/module/blank/proper_path_tools/tests/inc/mod.rs @@ -0,0 +1,4 @@ +#[ allow( unused_imports ) ] +use super::*; + +mod basic_test; diff --git a/module/blank/proper_path_tools/tests/smoke_test.rs b/module/blank/proper_path_tools/tests/smoke_test.rs new file mode 100644 index 0000000000..663dd6fb9f --- /dev/null +++ b/module/blank/proper_path_tools/tests/smoke_test.rs @@ -0,0 +1,12 @@ + +#[ test ] +fn local_smoke_test() +{ + ::test_tools::smoke_test_for_local_run(); +} + +#[ test ] +fn published_smoke_test() +{ + ::test_tools::smoke_test_for_published_run(); +} diff --git a/module/core/proper_path_tools/tests/tests.rs b/module/blank/proper_path_tools/tests/tests.rs similarity index 100% rename from module/core/proper_path_tools/tests/tests.rs rename to module/blank/proper_path_tools/tests/tests.rs diff --git a/module/core/async_from/Cargo.toml b/module/core/async_from/Cargo.toml new file mode 100644 index 0000000000..b6be30c5c7 --- /dev/null +++ b/module/core/async_from/Cargo.toml @@ -0,0 +1,38 @@ +[package] +name = "async_from" +version = "0.2.0" +edition = "2021" +authors = [ + "Kostiantyn Wandalen ", +] +license = "MIT" +readme = "Readme.md" +documentation = "https://docs.rs/async_from" +repository = "https://github.com/Wandalen/wTools/tree/master/module/core/async_from" +homepage = "https://github.com/Wandalen/wTools/tree/master/module/core/async_from" +description = """ +Async version of From, Into, TryFrom, TryInto. +""" +categories = [ "algorithms", "development-tools" ] +keywords = [ "fundamental", "general-purpose" ] + +[lints] +workspace = true + +[package.metadata.docs.rs] +features = [ "full" ] +all-features = false + +[features] +default = [ "enabled", "async_from", "async_try_from" ] +full = [ "default" ] +enabled = [] +async_from = [] +async_try_from = [] + +[dependencies] +async-trait = { workspace = true } + +[dev-dependencies] +# test_tools = { workspace = true } +tokio = { workspace = true, features = [ "rt-multi-thread", "time", "macros" ] } diff --git a/module/core/async_from/License b/module/core/async_from/License new file mode 100644 index 0000000000..0804aed8e3 --- /dev/null +++ b/module/core/async_from/License @@ -0,0 +1,22 @@ +Copyright Kostiantyn Mysnyk and Out of the Box Systems (c) 2021-2024 + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/module/core/async_from/Readme.md b/module/core/async_from/Readme.md new file mode 100644 index 0000000000..374fd4595c --- /dev/null +++ b/module/core/async_from/Readme.md @@ -0,0 +1,91 @@ + + +# Module :: async_from +[![experimental](https://raster.shields.io/static/v1?label=stability&message=experimental&color=orange&logoColor=eee)](https://github.com/emersion/stability-badges#experimental) [![rust-status](https://github.com/Wandalen/wTools/actions/workflows/Moduleasync_fromPush.yml/badge.svg)](https://github.com/Wandalen/wTools/actions/workflows/Moduleasync_fromPush.yml) [![docs.rs](https://img.shields.io/docsrs/async_from?color=e3e8f0&logo=docs.rs)](https://docs.rs/async_from) [![discord](https://img.shields.io/discord/872391416519737405?color=eee&logo=discord&logoColor=eee&label=ask)](https://discord.gg/m3YfbXpUUY) + +Async version of From, Into, TryFrom, TryInto. + +The `async_from` crate provides asynchronous versions of the well-known `From`, `Into`, `TryFrom`, and `TryInto` traits. These traits are essential for handling conversions in Rust, and their asynchronous counterparts, allowing for conversions that involve asynchronous operations. + +## Why Asynchronous Conversion Traits? + +In Rust, the `From`, `Into`, `TryFrom`, and `TryInto` traits provide a standardized way to handle type conversions. The `async_from` module extends this functionality to asynchronous contexts with `AsyncFrom`, `AsyncInto`, `AsyncTryFrom`, and `AsyncTryInto` traits, offering several key benefits: + +- **Simplicity**: Allow straightforward conversions without boilerplate, even in asynchronous contexts. +- **Consistency**: Provide a uniform interface for conversions across different types, aiding in writing predictable and maintainable code. +- **Error Handling**: Enable safe and explicit handling of conversion failures, essential for robust error management in commercial applications. +- **Asynchronous Contexts**: Facilitate conversions involving asynchronous operations, such as network requests or database queries, which are common in modern applications. + +The `async_from` provides developers with the tools needed to handle complex conversions in an async context efficiently, which is particularly important for commercial applications requiring reliable and efficient handling of asynchronous operations. + +### `AsyncFrom` and `AsyncInto` + +Trait for asynchronous conversions from a type T. + +These traits are designed for infallible asynchronous conversions. They allow you to convert types asynchronously, returning the result directly. + +```rust +use async_from::{ async_trait, AsyncFrom, AsyncInto }; + +struct MyNumber( u32 ); + +#[ async_trait ] +impl AsyncFrom< String > for MyNumber +{ + async fn async_from( value : String ) -> Self + { + let num = value.parse::< u32 >().unwrap_or( 0 ); + MyNumber( num ) + } +} + +#[ tokio::main ] +async fn main() +{ + let num = MyNumber::async_from( "42".to_string() ).await; + println!( "Converted: {}", num.0 ); + let num : MyNumber = "42".to_string().async_into().await; + println!( "Converted: {}", num.0 ); +} +``` + +### `AsyncTryFrom` and `AsyncTryInto` + +Trait for asynchronous fallible conversions from a type T. + +These traits are for fallible asynchronous conversions, where the conversion might fail. They return a `Result` wrapped in a `Future`, allowing you to handle errors gracefully. + +```rust +use async_from::{ async_trait, AsyncTryFrom, AsyncTryInto }; +use std::num::ParseIntError; + +struct MyNumber( u32 ); + +#[ async_trait ] +impl AsyncTryFrom< String > for MyNumber +{ + type Error = ParseIntError; + + async fn async_try_from( value : String ) -> Result< Self, Self::Error > + { + let num = value.parse::< u32 >()?; + Ok( MyNumber( num ) ) + } +} + +#[ tokio::main ] +async fn main() +{ + match MyNumber::async_try_from( "42".to_string() ).await + { + Ok( my_num ) => println!( "Converted successfully: {}", my_num.0 ), + Err( e ) => println!( "Conversion failed: {:?}", e ), + } + let result : Result< MyNumber, _ > = "42".to_string().async_try_into().await; + match result + { + Ok( my_num ) => println!( "Converted successfully using AsyncTryInto: {}", my_num.0 ), + Err( e ) => println!( "Conversion failed using AsyncTryInto: {:?}", e ), + } +} +``` diff --git a/module/core/async_from/src/lib.rs b/module/core/async_from/src/lib.rs new file mode 100644 index 0000000000..b2419ae521 --- /dev/null +++ b/module/core/async_from/src/lib.rs @@ -0,0 +1,316 @@ + +#![ doc( html_logo_url = "https://raw.githubusercontent.com/Wandalen/wTools/master/asset/img/logo_v3_trans_square.png" ) ] +#![ doc( html_favicon_url = "https://raw.githubusercontent.com/Wandalen/wTools/alpha/asset/img/logo_v3_trans_square_icon_small_v2.ico" ) ] +#![ doc( html_root_url = "https://docs.rs/async_from/latest/async_from/" ) ] +#![ doc = include_str!( concat!( env!( "CARGO_MANIFEST_DIR" ), "/", "Readme.md" ) ) ] + +/// Namespace with dependencies. +#[ cfg( feature = "enabled" ) ] +pub mod dependency +{ + pub use ::async_trait; +} + +/// Internal namespace. +#[ cfg( feature = "enabled" ) ] +mod private +{ + + pub use async_trait::async_trait; + use std::fmt::Debug; + + /// Trait for asynchronous conversions from a type `T`. + /// + /// This trait allows for conversions that occur asynchronously, returning a `Future`. + /// + /// # Example + /// + /// ```rust + /// use async_from::{ async_trait, AsyncFrom }; + /// + /// struct MyNumber( u32 ); + /// + /// #[ async_trait ] + /// impl AsyncFrom< String > for MyNumber + /// { + /// async fn async_from( value : String ) -> Self + /// { + /// let num = value.parse::< u32 >().unwrap_or( 0 ); + /// MyNumber( num ) + /// } + /// } + /// + /// #[ tokio::main ] + /// async fn main() + /// { + /// let num = MyNumber::async_from( "42".to_string() ).await; + /// println!( "Converted: {}", num.0 ); + /// } + /// ``` + #[ cfg( feature = "async_from" ) ] + #[ async_trait ] + pub trait AsyncFrom< T > : Sized + { + /// Asynchronously converts a value of type `T` into `Self`. + /// + /// # Arguments + /// + /// * `value` - The value to be converted. + /// + /// # Returns + /// + /// * `Self` - The converted value. + async fn async_from( value : T ) -> Self; + } + + /// Trait for asynchronous conversions into a type `T`. + /// + /// This trait provides a method to convert `Self` into `T` asynchronously. + /// + /// # Example + /// + /// ```rust + /// use async_from::{ async_trait, AsyncFrom, AsyncInto }; + /// + /// struct MyNumber( u32 ); + /// + /// #[ async_trait ] + /// impl AsyncFrom< String > for MyNumber + /// { + /// async fn async_from( value : String ) -> Self + /// { + /// let num = value.parse::< u32 >().unwrap_or( 0 ); + /// MyNumber( num ) + /// } + /// } + /// + /// #[ tokio::main ] + /// async fn main() + /// { + /// let num : MyNumber = "42".to_string().async_into().await; + /// println!( "Converted: {}", num.0 ); + /// } + /// ``` + #[ async_trait ] + #[ cfg( feature = "async_from" ) ] + pub trait AsyncInto< T > : Sized + { + /// Asynchronously converts `Self` into a value of type `T`. + /// + /// # Returns + /// + /// * `T` - The converted value. + async fn async_into( self ) -> T; + } + + /// Blanket implementation of `AsyncInto` for any type that implements `AsyncFrom`. + /// + /// This implementation allows any type `T` that implements `AsyncFrom` to also implement `AsyncInto`. + #[ async_trait ] + #[ cfg( feature = "async_from" ) ] + impl< T, U > AsyncInto< U > for T + where + U : AsyncFrom< T > + Send, + T : Send, + { + /// Asynchronously converts `Self` into a value of type `U` using `AsyncFrom`. + /// + /// # Returns + /// + /// * `U` - The converted value. + async fn async_into( self ) -> U + { + U::async_from( self ).await + } + } + + /// Trait for asynchronous fallible conversions from a type `T`. + /// + /// This trait allows for conversions that may fail, returning a `Result` wrapped in a `Future`. + /// + /// # Example + /// + /// ```rust + /// use async_from::{ async_trait, AsyncTryFrom }; + /// use std::num::ParseIntError; + /// + /// struct MyNumber( u32 ); + /// + /// #[ async_trait ] + /// impl AsyncTryFrom< String > for MyNumber + /// { + /// type Error = ParseIntError; + /// + /// async fn async_try_from( value : String ) -> Result< Self, Self::Error > + /// { + /// let num = value.parse::< u32 >()?; + /// Ok( MyNumber( num ) ) + /// } + /// } + /// + /// #[ tokio::main ] + /// async fn main() + /// { + /// match MyNumber::async_try_from( "42".to_string() ).await + /// { + /// Ok( my_num ) => println!( "Converted successfully: {}", my_num.0 ), + /// Err( e ) => println!( "Conversion failed: {:?}", e ), + /// } + /// } + /// ``` + #[ async_trait ] + #[ cfg( feature = "async_try_from" ) ] + pub trait AsyncTryFrom< T > : Sized + { + /// The error type returned if the conversion fails. + type Error : Debug; + + /// Asynchronously attempts to convert a value of type `T` into `Self`. + /// + /// # Arguments + /// + /// * `value` - The value to be converted. + /// + /// # Returns + /// + /// * `Result` - On success, returns the converted value. On failure, returns an error. + async fn async_try_from( value : T ) -> Result< Self, Self::Error >; + } + + /// Trait for asynchronous fallible conversions into a type `T`. + /// + /// This trait provides a method to convert `Self` into `T`, potentially returning an error. + /// + /// # Example + /// + /// ```rust + /// use async_from::{ async_trait, AsyncTryFrom, AsyncTryInto }; + /// use std::num::ParseIntError; + /// + /// struct MyNumber( u32 ); + /// + /// #[ async_trait ] + /// impl AsyncTryFrom< String > for MyNumber + /// { + /// type Error = ParseIntError; + /// + /// async fn async_try_from( value : String ) -> Result< Self, Self::Error > + /// { + /// let num = value.parse::< u32 >()?; + /// Ok( MyNumber( num ) ) + /// } + /// } + /// + /// #[ tokio::main ] + /// async fn main() + /// { + /// let result : Result< MyNumber, _ > = "42".to_string().async_try_into().await; + /// match result + /// { + /// Ok( my_num ) => println!( "Converted successfully using AsyncTryInto: {}", my_num.0 ), + /// Err( e ) => println!( "Conversion failed using AsyncTryInto: {:?}", e ), + /// } + /// } + /// ``` + #[ async_trait ] + #[ cfg( feature = "async_try_from" ) ] + pub trait AsyncTryInto< T > : Sized + { + /// The error type returned if the conversion fails. + type Error : Debug; + + /// Asynchronously attempts to convert `Self` into a value of type `T`. + /// + /// # Returns + /// + /// * `Result` - On success, returns the converted value. On failure, returns an error. + async fn async_try_into( self ) -> Result< T, Self::Error >; + } + + /// Blanket implementation of `AsyncTryInto` for any type that implements `AsyncTryFrom`. + /// + /// This implementation allows any type `T` that implements `AsyncTryFrom` to also implement `AsyncTryInto`. + #[ async_trait ] + #[ cfg( feature = "async_try_from" ) ] + impl< T, U > AsyncTryInto< U > for T + where + U : AsyncTryFrom< T > + Send, + T : Send, + { + type Error = U::Error; + + /// Asynchronously converts `Self` into a value of type `U` using `AsyncTryFrom`. + /// + /// # Returns + /// + /// * `Result` - On success, returns the converted value. On failure, returns an error. + async fn async_try_into( self ) -> Result< U, Self::Error > + { + U::async_try_from( self ).await + } + } + +} + +#[ cfg( feature = "enabled" ) ] +#[ doc( inline ) ] +#[ allow( unused_imports ) ] +pub use own::*; + +/// Own namespace of the module. +#[ cfg( feature = "enabled" ) ] +#[ allow( unused_imports ) ] +pub mod own +{ + use super::*; + #[ doc( inline ) ] + pub use orphan::*; +} + +/// Orphan namespace of the module. +#[ cfg( feature = "enabled" ) ] +#[ allow( unused_imports ) ] +pub mod orphan +{ + use super::*; + #[ doc( inline ) ] + pub use exposed::*; + +} + +/// Exposed namespace of the module. +#[ cfg( feature = "enabled" ) ] +#[ allow( unused_imports ) ] +pub mod exposed +{ + use super::*; + + #[ doc( inline ) ] + pub use prelude::*; + + #[ doc( inline ) ] + pub use ::async_trait::async_trait; + + #[ cfg( feature = "async_from" ) ] + pub use private:: + { + AsyncFrom, + AsyncInto, + }; + + #[ cfg( feature = "async_try_from" ) ] + pub use private:: + { + AsyncTryFrom, + AsyncTryInto, + }; + +} + +/// Prelude to use essentials: `use my_module::prelude::*`. +#[ cfg( feature = "enabled" ) ] +#[ allow( unused_imports ) ] +pub mod prelude +{ + use super::*; +} diff --git a/module/core/async_from/tests/inc/basic_test.rs b/module/core/async_from/tests/inc/basic_test.rs new file mode 100644 index 0000000000..dce63a4c1e --- /dev/null +++ b/module/core/async_from/tests/inc/basic_test.rs @@ -0,0 +1,84 @@ +use super::*; + +#[ tokio::test ] +async fn async_try_from_test() +{ + + // Example implementation of AsyncTryFrom for a custom type + struct MyNumber( u32 ); + + // xxx : qqq : broken + // #[ the_module::async_trait ] + // impl< 'a > the_module::AsyncTryFrom< &'a str > for MyNumber + // { + // type Error = std::num::ParseIntError; + // + // async fn async_try_from( value : &'a str ) -> Result< Self, Self::Error > + // { + // // Simulate asynchronous work + // tokio::time::sleep( tokio::time::Duration::from_millis( 1 ) ).await; + // let num = value.parse::< u32 >()?; + // Ok( MyNumber( num ) ) + // } + // } + + #[ the_module::async_trait ] + impl the_module::AsyncTryFrom< String > for MyNumber + { + type Error = std::num::ParseIntError; + + async fn async_try_from( value : String ) -> Result< Self, Self::Error > + { + // Simulate asynchronous work + tokio::time::sleep( tokio::time::Duration::from_millis( 10 ) ).await; + let num = value.parse::< u32 >()?; + Ok( MyNumber( num ) ) + } + } + + use the_module::{ AsyncTryFrom, AsyncTryInto }; + + // Using AsyncTryFrom directly + match MyNumber::async_try_from( "42".to_string() ).await + { + Ok( my_num ) => println!( "Converted successfully: {}", my_num.0 ), + Err( e ) => println!( "Conversion failed: {:?}", e ), + } + + // Using AsyncTryInto, which is automatically implemented + let result : Result< MyNumber, _ > = "42".to_string().async_try_into().await; + match result + { + Ok( my_num ) => println!( "Converted successfully using AsyncTryInto: {}", my_num.0 ), + Err( e ) => println!( "Conversion failed using AsyncTryInto: {:?}", e ), + } +} + +#[ tokio::test ] +async fn async_from_test() +{ + // Example implementation of AsyncFrom for a custom type + struct MyNumber( u32 ); + + #[ the_module::async_trait ] + impl the_module::AsyncFrom< String > for MyNumber + { + async fn async_from( value : String ) -> Self + { + // Simulate asynchronous work + tokio::time::sleep( tokio::time::Duration::from_millis( 10 ) ).await; + let num = value.parse::< u32 >().unwrap_or( 0 ); + MyNumber( num ) + } + } + + use the_module::{ AsyncFrom, AsyncInto }; + + // Using AsyncFrom directly + let my_num : MyNumber = MyNumber::async_from( "42".to_string() ).await; + println!( "Converted successfully using AsyncFrom: {}", my_num.0 ); + + // Using AsyncInto, which is automatically implemented + let my_num : MyNumber = "42".to_string().async_into().await; + println!( "Converted successfully using AsyncInto: {}", my_num.0 ); +} diff --git a/module/core/async_from/tests/inc/mod.rs b/module/core/async_from/tests/inc/mod.rs new file mode 100644 index 0000000000..329271ad56 --- /dev/null +++ b/module/core/async_from/tests/inc/mod.rs @@ -0,0 +1,3 @@ +use super::*; + +mod basic_test; diff --git a/module/core/async_from/tests/tests.rs b/module/core/async_from/tests/tests.rs new file mode 100644 index 0000000000..299521de4e --- /dev/null +++ b/module/core/async_from/tests/tests.rs @@ -0,0 +1,9 @@ +#![ allow( unused_imports ) ] + +include!( "../../../../module/step/meta/src/module/terminal.rs" ); + +use async_from as the_module; +// use test_tools::exposed::*; + +#[ cfg( feature = "enabled" ) ] +mod inc; diff --git a/module/core/async_tools/Cargo.toml b/module/core/async_tools/Cargo.toml new file mode 100644 index 0000000000..0f6c4f835b --- /dev/null +++ b/module/core/async_tools/Cargo.toml @@ -0,0 +1,39 @@ +[package] +name = "async_tools" +version = "0.1.0" +edition = "2021" +authors = [ + "Kostiantyn Wandalen ", +] +license = "MIT" +readme = "Readme.md" +documentation = "https://docs.rs/async_tools" +repository = "https://github.com/Wandalen/wTools/tree/master/module/core/async_tools" +homepage = "https://github.com/Wandalen/wTools/tree/master/module/core/async_tools" +description = """ +Toolkit for asynchronous programming. +""" +categories = [ "algorithms", "development-tools" ] +keywords = [ "fundamental", "general-purpose" ] + +[lints] +workspace = true + +[package.metadata.docs.rs] +features = [ "full" ] +all-features = false + +[features] +default = [ "enabled", "async_from", "async_try_from" ] +full = [ "default" ] +enabled = [] +async_from = [ "async_from/async_from" ] +async_try_from = [ "async_from/async_try_from" ] + +[dependencies] +async-trait = { workspace = true } +async_from = { workspace = true } + +[dev-dependencies] +# test_tools = { workspace = true } +tokio = { workspace = true, default-features = false, features = [ "rt-multi-thread", "time", "macros" ] } diff --git a/module/core/async_tools/License b/module/core/async_tools/License new file mode 100644 index 0000000000..0804aed8e3 --- /dev/null +++ b/module/core/async_tools/License @@ -0,0 +1,22 @@ +Copyright Kostiantyn Mysnyk and Out of the Box Systems (c) 2021-2024 + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/module/core/async_tools/Readme.md b/module/core/async_tools/Readme.md new file mode 100644 index 0000000000..0b469a2688 --- /dev/null +++ b/module/core/async_tools/Readme.md @@ -0,0 +1,6 @@ + + +# Module :: async_tools +[![experimental](https://raster.shields.io/static/v1?label=stability&message=experimental&color=orange&logoColor=eee)](https://github.com/emersion/stability-badges#experimental) [![rust-status](https://github.com/Wandalen/wTools/actions/workflows/Moduleasync_fromPush.yml/badge.svg)](https://github.com/Wandalen/wTools/actions/workflows/Moduleasync_fromPush.yml) [![docs.rs](https://img.shields.io/docsrs/async_tools?color=e3e8f0&logo=docs.rs)](https://docs.rs/async_tools) [![discord](https://img.shields.io/discord/872391416519737405?color=eee&logo=discord&logoColor=eee&label=ask)](https://discord.gg/m3YfbXpUUY) + +Toolkit for asynchronous programming. diff --git a/module/core/async_tools/src/lib.rs b/module/core/async_tools/src/lib.rs new file mode 100644 index 0000000000..ab0bcbf7e8 --- /dev/null +++ b/module/core/async_tools/src/lib.rs @@ -0,0 +1,79 @@ + +#![ doc( html_logo_url = "https://raw.githubusercontent.com/Wandalen/wTools/master/asset/img/logo_v3_trans_square.png" ) ] +#![ doc( html_favicon_url = "https://raw.githubusercontent.com/Wandalen/wTools/alpha/asset/img/logo_v3_trans_square_icon_small_v2.ico" ) ] +#![ doc( html_root_url = "https://docs.rs/async_tools/latest/async_tools/" ) ] +#![ doc = include_str!( concat!( env!( "CARGO_MANIFEST_DIR" ), "/", "Readme.md" ) ) ] + +/// Namespace with dependencies. +#[ cfg( feature = "enabled" ) ] +pub mod dependency +{ + pub use ::async_trait; + pub use ::async_from; +} + +/// Internal namespace. +#[ cfg( feature = "enabled" ) ] +mod private +{ +} + +#[ cfg( feature = "enabled" ) ] +#[ doc( inline ) ] +#[ allow( unused_imports ) ] +pub use own::*; + +/// Own namespace of the module. +#[ cfg( feature = "enabled" ) ] +#[ allow( unused_imports ) ] +pub mod own +{ + use super::*; + #[ doc( inline ) ] + pub use orphan::*; + + #[ doc( inline ) ] + pub use ::async_from::orphan::*; + +} + +/// Orphan namespace of the module. +#[ cfg( feature = "enabled" ) ] +#[ allow( unused_imports ) ] +pub mod orphan +{ + use super::*; + #[ doc( inline ) ] + pub use exposed::*; + +} + +/// Exposed namespace of the module. +#[ cfg( feature = "enabled" ) ] +#[ allow( unused_imports ) ] +pub mod exposed +{ + use super::*; + + #[ doc( inline ) ] + pub use prelude::*; + + #[ doc( inline ) ] + pub use ::async_trait::async_trait; + + #[ doc( inline ) ] + pub use ::async_from::exposed::*; + +} + +/// Prelude to use essentials: `use my_module::prelude::*`. +#[ cfg( feature = "enabled" ) ] +#[ allow( unused_imports ) ] +pub mod prelude +{ + use super::*; + + #[ doc( inline ) ] + pub use ::async_from::prelude::*; + +} diff --git a/module/core/async_tools/tests/inc/basic_test.rs b/module/core/async_tools/tests/inc/basic_test.rs new file mode 100644 index 0000000000..c652899926 --- /dev/null +++ b/module/core/async_tools/tests/inc/basic_test.rs @@ -0,0 +1,84 @@ +use super::*; + +#[ tokio::test ] +async fn async_try_from_test() +{ + + // Example implementation of AsyncTryFrom for a custom type + struct MyNumber( u32 ); + + // xxx : qqq : broken + // #[ the_module::async_trait ] + // impl< 'a > the_module::AsyncTryFrom< &'a str > for MyNumber + // { + // type Error = std::num::ParseIntError; + // + // async fn async_try_from( value : &'a str ) -> Result< Self, Self::Error > + // { + // // Simulate asynchronous work + // tokio::time::sleep( tokio::time::Duration::from_millis( 1 ) ).await; + // let num = value.parse::< u32 >()?; + // Ok( MyNumber( num ) ) + // } + // } + + #[ the_module::async_trait ] + impl the_module::AsyncTryFrom< String > for MyNumber + { + type Error = std::num::ParseIntError; + + async fn async_try_from( value : String ) -> Result< Self, Self::Error > + { + // Simulate asynchronous work + tokio::time::sleep( tokio::time::Duration::from_millis( 10 ) ).await; + let num = value.parse::< u32 >()?; + Ok( MyNumber( num ) ) + } + } + + use the_module::{ AsyncTryFrom, AsyncTryInto }; + + // Using AsyncTryFrom directly + match MyNumber::async_try_from( "42".to_string() ).await + { + Ok( my_num ) => println!( "Converted successfully: {}", my_num.0 ), + Err( e ) => println!( "Conversion failed: {:?}", e ), + } + + // Using AsyncTryInto, which is automatically implemented + let result : Result< MyNumber, _ > = "42".to_string().async_try_into().await; + match result + { + Ok( my_num ) => println!( "Converted successfully using AsyncTryInto: {}", my_num.0 ), + Err( e ) => println!( "Conversion failed using AsyncTryInto: {:?}", e ), + } +} + +#[ tokio::test ] +async fn async_from_test() +{ + // Example implementation of AsyncFrom for a custom type + struct MyNumber( u32 ); + + #[ the_module::async_trait ] + impl the_module::AsyncFrom< String > for MyNumber + { + async fn async_tools( value : String ) -> Self + { + // Simulate asynchronous work + tokio::time::sleep( tokio::time::Duration::from_millis( 10 ) ).await; + let num = value.parse::< u32 >().unwrap_or( 0 ); + MyNumber( num ) + } + } + + use the_module::{ AsyncFrom, AsyncInto }; + + // Using AsyncFrom directly + let my_num : MyNumber = MyNumber::async_tools( "42".to_string() ).await; + println!( "Converted successfully using AsyncFrom: {}", my_num.0 ); + + // Using AsyncInto, which is automatically implemented + let my_num : MyNumber = "42".to_string().async_into().await; + println!( "Converted successfully using AsyncInto: {}", my_num.0 ); +} diff --git a/module/core/async_tools/tests/inc/mod.rs b/module/core/async_tools/tests/inc/mod.rs new file mode 100644 index 0000000000..329271ad56 --- /dev/null +++ b/module/core/async_tools/tests/inc/mod.rs @@ -0,0 +1,3 @@ +use super::*; + +mod basic_test; diff --git a/module/core/async_tools/tests/tests.rs b/module/core/async_tools/tests/tests.rs new file mode 100644 index 0000000000..42f32553db --- /dev/null +++ b/module/core/async_tools/tests/tests.rs @@ -0,0 +1,10 @@ +#![ allow( unused_imports ) ] + +include!( "../../../../module/step/meta/src/module/terminal.rs" ); + +use async_tools as the_module; +// use test_tools::exposed::*; + +#[ cfg( feature = "enabled" ) ] +#[ path = "../../../../module/core/async_from/tests/inc/mod.rs" ] +mod inc; diff --git a/module/core/clone_dyn/Cargo.toml b/module/core/clone_dyn/Cargo.toml index b27b73a6a0..400ba0e1fb 100644 --- a/module/core/clone_dyn/Cargo.toml +++ b/module/core/clone_dyn/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "clone_dyn" -version = "0.25.0" +version = "0.29.0" edition = "2021" authors = [ "Kostiantyn Wandalen ", @@ -36,6 +36,7 @@ derive_clone_dyn = [ "dep:clone_dyn_meta", "clone_dyn_meta/enabled", "clone_dyn_ [dependencies] clone_dyn_meta = { workspace = true, optional = true } clone_dyn_types = { workspace = true, optional = true } +# clone_dyn_types = { version = "0.27.0", optional = true } [dev-dependencies] test_tools = { workspace = true } diff --git a/module/core/clone_dyn/src/lib.rs b/module/core/clone_dyn/src/lib.rs index 224432e031..18e0150163 100644 --- a/module/core/clone_dyn/src/lib.rs +++ b/module/core/clone_dyn/src/lib.rs @@ -5,7 +5,6 @@ #![ doc = include_str!( concat!( env!( "CARGO_MANIFEST_DIR" ), "/", "Readme.md" ) ) ] /// Namespace with dependencies. - #[ cfg( feature = "enabled" ) ] pub mod dependency { diff --git a/module/core/clone_dyn_meta/Cargo.toml b/module/core/clone_dyn_meta/Cargo.toml index 2359fb19c7..d77ad96088 100644 --- a/module/core/clone_dyn_meta/Cargo.toml +++ b/module/core/clone_dyn_meta/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "clone_dyn_meta" -version = "0.24.0" +version = "0.27.0" edition = "2021" authors = [ "Kostiantyn Wandalen ", diff --git a/module/core/clone_dyn_types/Cargo.toml b/module/core/clone_dyn_types/Cargo.toml index 65eec4f684..4a145d0c13 100644 --- a/module/core/clone_dyn_types/Cargo.toml +++ b/module/core/clone_dyn_types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "clone_dyn_types" -version = "0.24.0" +version = "0.26.0" edition = "2021" authors = [ "Kostiantyn Wandalen ", diff --git a/module/core/collection_tools/Cargo.toml b/module/core/collection_tools/Cargo.toml index 96ad524cc9..86dcfa51b3 100644 --- a/module/core/collection_tools/Cargo.toml +++ b/module/core/collection_tools/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "collection_tools" -version = "0.13.0" +version = "0.15.0" edition = "2021" authors = [ "Kostiantyn Wandalen ", @@ -28,7 +28,7 @@ all-features = false [features] no_std = [ - "test_tools/no_std", + # "test_tools/no_std", ] use_alloc = [ diff --git a/module/core/data_type/Cargo.toml b/module/core/data_type/Cargo.toml index f42fae69bd..c5f7155d97 100644 --- a/module/core/data_type/Cargo.toml +++ b/module/core/data_type/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "data_type" -version = "0.10.0" +version = "0.12.0" edition = "2021" authors = [ "Kostiantyn Wandalen ", @@ -32,7 +32,6 @@ default = [ # "use_std", "enabled", "dt_either", - "dt_prelude", "dt_interval", "dt_collection", # "dt_make", @@ -43,7 +42,6 @@ full = [ # "use_std", "enabled", "dt_either", - "dt_prelude", "dt_interval", "dt_collection", # "dt_make", @@ -54,43 +52,18 @@ no_std = [] use_alloc = [ "no_std" ] enabled = [] -# dt_prelude = [ "collection_tools/reexports" ] -dt_prelude = [] # rid of maybe? dt_interval = [ "interval_adapter/enabled" ] dt_collection = [ "collection_tools/enabled" ] dt_either = [ "either" ] # qqq : for Anton : integrate all features of collection_tools into data_type and reuse tests -# dt_type_constructor = [ "type_constructor/enabled" ] -# dt_make = [ "type_constructor/make" ] -# dt_vectorized_from = [ "type_constructor/vectorized_from" ] - -# = entries - -# [lib] -# name = "data_type" -# path = "src/dt/data_type_lib.rs" - -# [[test]] -# name = "data_type_test" -# path = "tests/dt/data_type_tests.rs" -# -# [[test]] -# name = "data_type_smoke_test" -# path = "tests/_integration_test/smoke_test.rs" -# -# [[example]] -# name = "data_type_trivial" -# path = "examples/data_type_trivial/src/main.rs" - [dependencies] ## external either = { version = "~1.6", optional = true } ## internal -# type_constructor = { workspace = true } interval_adapter = { workspace = true } collection_tools = { workspace = true } diff --git a/module/core/data_type/src/lib.rs b/module/core/data_type/src/lib.rs index 5f16a02ecb..7cdff4fae2 100644 --- a/module/core/data_type/src/lib.rs +++ b/module/core/data_type/src/lib.rs @@ -123,13 +123,13 @@ pub mod prelude pub use crate::dependency::collection_tools::prelude::*; // #[ cfg( any( not( feature = "no_std" ), feature = "use_alloc" ) ) ] - #[ cfg( feature = "dt_prelude" ) ] - #[ doc( inline ) ] - #[ allow( unused_imports ) ] - pub use core:: - { - fmt, - }; + // #[ cfg( feature = "dt_prelude" ) ] + // #[ doc( inline ) ] + // #[ allow( unused_imports ) ] + // pub use core:: + // { + // fmt, + // }; } diff --git a/module/core/derive_tools/Cargo.toml b/module/core/derive_tools/Cargo.toml index 0dd6c2d30f..a2d1e31fb4 100644 --- a/module/core/derive_tools/Cargo.toml +++ b/module/core/derive_tools/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "derive_tools" -version = "0.29.0" +version = "0.32.0" edition = "2021" authors = [ "Kostiantyn Wandalen ", diff --git a/module/core/derive_tools_meta/Cargo.toml b/module/core/derive_tools_meta/Cargo.toml index a5210dcfa6..ce3e0ce395 100644 --- a/module/core/derive_tools_meta/Cargo.toml +++ b/module/core/derive_tools_meta/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "derive_tools_meta" -version = "0.28.0" +version = "0.31.0" edition = "2021" authors = [ "Kostiantyn Wandalen ", diff --git a/module/core/diagnostics_tools/Cargo.toml b/module/core/diagnostics_tools/Cargo.toml index f8f93610c9..6b48adc190 100644 --- a/module/core/diagnostics_tools/Cargo.toml +++ b/module/core/diagnostics_tools/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "diagnostics_tools" -version = "0.9.0" +version = "0.10.0" edition = "2021" authors = [ "Kostiantyn Wandalen ", diff --git a/module/core/error_tools/Cargo.toml b/module/core/error_tools/Cargo.toml index 62f8ec7e88..de02c81004 100644 --- a/module/core/error_tools/Cargo.toml +++ b/module/core/error_tools/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "error_tools" -version = "0.17.0" +version = "0.19.0" edition = "2021" authors = [ "Kostiantyn Wandalen ", diff --git a/module/core/for_each/Cargo.toml b/module/core/for_each/Cargo.toml index c6387ef2cc..2e43d14153 100644 --- a/module/core/for_each/Cargo.toml +++ b/module/core/for_each/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "for_each" -version = "0.9.0" +version = "0.10.0" edition = "2021" authors = [ "Kostiantyn Wandalen ", diff --git a/module/core/former/Cargo.toml b/module/core/former/Cargo.toml index 6ccdadb0b4..df2a419b2b 100644 --- a/module/core/former/Cargo.toml +++ b/module/core/former/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "former" -version = "2.9.0" +version = "2.11.0" edition = "2021" authors = [ "Kostiantyn Wandalen ", @@ -65,5 +65,5 @@ former_types = { workspace = true } [dev-dependencies] -test_tools = { workspace = true, features = [ "full" ] } +test_tools = { workspace = true } collection_tools = { workspace = true, features = [ "collection_constructors" ] } diff --git a/module/core/former_meta/Cargo.toml b/module/core/former_meta/Cargo.toml index 1612da9af5..38845bc3f1 100644 --- a/module/core/former_meta/Cargo.toml +++ b/module/core/former_meta/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "former_meta" -version = "2.9.0" +version = "2.11.0" edition = "2021" authors = [ "Kostiantyn Wandalen ", @@ -57,4 +57,4 @@ iter_tools = { workspace = true } convert_case = { version = "0.6.0", default-features = false, optional = true, features = [] } [dev-dependencies] -test_tools = { workspace = true, features = [ "full" ] } +test_tools = { workspace = true } diff --git a/module/core/former_types/Cargo.toml b/module/core/former_types/Cargo.toml index 9277639847..1049a6c8bd 100644 --- a/module/core/former_types/Cargo.toml +++ b/module/core/former_types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "former_types" -version = "2.9.0" +version = "2.12.0" edition = "2021" authors = [ "Kostiantyn Wandalen ", @@ -50,4 +50,4 @@ collection_tools = { workspace = true, features = [ "collection_constructors" ] [dev-dependencies] -test_tools = { workspace = true, features = [ "full" ] } +test_tools = { workspace = true } diff --git a/module/core/implements/Cargo.toml b/module/core/implements/Cargo.toml index 283004045e..8c468c0b60 100644 --- a/module/core/implements/Cargo.toml +++ b/module/core/implements/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "implements" -version = "0.9.0" +version = "0.10.0" edition = "2021" authors = [ "Kostiantyn Wandalen ", diff --git a/module/core/impls_index/Cargo.toml b/module/core/impls_index/Cargo.toml index 65c5781edd..1845411740 100644 --- a/module/core/impls_index/Cargo.toml +++ b/module/core/impls_index/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "impls_index" -version = "0.8.0" +version = "0.9.0" edition = "2021" authors = [ "Kostiantyn Wandalen ", diff --git a/module/core/impls_index_meta/Cargo.toml b/module/core/impls_index_meta/Cargo.toml index e680f0cc47..036c5a03d0 100644 --- a/module/core/impls_index_meta/Cargo.toml +++ b/module/core/impls_index_meta/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "impls_index_meta" -version = "0.8.0" +version = "0.9.0" edition = "2021" authors = [ "Kostiantyn Wandalen ", diff --git a/module/core/inspect_type/Cargo.toml b/module/core/inspect_type/Cargo.toml index 5bb17bb058..260320b11b 100644 --- a/module/core/inspect_type/Cargo.toml +++ b/module/core/inspect_type/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "inspect_type" -version = "0.11.0" +version = "0.12.0" edition = "2021" authors = [ "Kostiantyn Wandalen ", diff --git a/module/core/interval_adapter/Cargo.toml b/module/core/interval_adapter/Cargo.toml index ba40cf4f31..787fac61c8 100644 --- a/module/core/interval_adapter/Cargo.toml +++ b/module/core/interval_adapter/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "interval_adapter" -version = "0.25.0" +version = "0.27.0" edition = "2021" authors = [ "Kostiantyn Wandalen ", diff --git a/module/core/is_slice/Cargo.toml b/module/core/is_slice/Cargo.toml index 17dc95d0f2..2854cf37cd 100644 --- a/module/core/is_slice/Cargo.toml +++ b/module/core/is_slice/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "is_slice" -version = "0.10.0" +version = "0.11.0" edition = "2021" authors = [ "Kostiantyn Wandalen ", diff --git a/module/core/iter_tools/Cargo.toml b/module/core/iter_tools/Cargo.toml index 0ab282194a..7e4dcad983 100644 --- a/module/core/iter_tools/Cargo.toml +++ b/module/core/iter_tools/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "iter_tools" -version = "0.22.0" +version = "0.24.0" edition = "2021" authors = [ "Kostiantyn Wandalen ", diff --git a/module/core/iter_tools/src/iter.rs b/module/core/iter_tools/src/iter.rs index 86fbda3f33..727e18409f 100644 --- a/module/core/iter_tools/src/iter.rs +++ b/module/core/iter_tools/src/iter.rs @@ -5,6 +5,8 @@ mod private #[ allow( unused_imports ) ] use crate::*; // use ::itertools::process_results; + + #[ cfg( feature = "iter_trait" ) ] use clone_dyn_types::CloneDyn; /// Trait that encapsulates an iterator with specific characteristics and implemetning `CloneDyn`. diff --git a/module/core/macro_tools/Cargo.toml b/module/core/macro_tools/Cargo.toml index 15c70c5298..99877d2e6f 100644 --- a/module/core/macro_tools/Cargo.toml +++ b/module/core/macro_tools/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "macro_tools" -version = "0.41.0" +version = "0.44.0" edition = "2021" authors = [ "Kostiantyn Wandalen ", diff --git a/module/core/mem_tools/Cargo.toml b/module/core/mem_tools/Cargo.toml index 79a60f163b..cec41724d4 100644 --- a/module/core/mem_tools/Cargo.toml +++ b/module/core/mem_tools/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mem_tools" -version = "0.7.0" +version = "0.8.0" edition = "2021" authors = [ "Kostiantyn Wandalen ", diff --git a/module/core/meta_tools/Cargo.toml b/module/core/meta_tools/Cargo.toml index c34c79a376..0fc0b3c61d 100644 --- a/module/core/meta_tools/Cargo.toml +++ b/module/core/meta_tools/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "meta_tools" -version = "0.11.0" +version = "0.12.0" edition = "2021" authors = [ "Kostiantyn Wandalen ", diff --git a/module/core/mod_interface/Cargo.toml b/module/core/mod_interface/Cargo.toml index 66a9f9bdc6..8f3e3f76f4 100644 --- a/module/core/mod_interface/Cargo.toml +++ b/module/core/mod_interface/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mod_interface" -version = "0.27.0" +version = "0.30.0" edition = "2021" authors = [ "Kostiantyn Wandalen ", diff --git a/module/core/mod_interface_meta/Cargo.toml b/module/core/mod_interface_meta/Cargo.toml index 7c5cf7ad26..ab3e6c709c 100644 --- a/module/core/mod_interface_meta/Cargo.toml +++ b/module/core/mod_interface_meta/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mod_interface_meta" -version = "0.26.0" +version = "0.29.0" edition = "2021" authors = [ "Kostiantyn Wandalen ", diff --git a/module/core/mod_interface_meta/src/lib.rs b/module/core/mod_interface_meta/src/lib.rs index f215f7f2ac..70dc68878e 100644 --- a/module/core/mod_interface_meta/src/lib.rs +++ b/module/core/mod_interface_meta/src/lib.rs @@ -43,7 +43,7 @@ // }; // } -// xxx : make use proper_path_tools::own::path working +// xxx : make use pth::own::path working // xxx : put modular files into a namespace `file` maybe // #[ cfg( feature = "enabled" ) ] diff --git a/module/core/process_tools/Cargo.toml b/module/core/process_tools/Cargo.toml index 6066e48942..e358031ef1 100644 --- a/module/core/process_tools/Cargo.toml +++ b/module/core/process_tools/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "process_tools" -version = "0.10.0" +version = "0.12.0" edition = "2021" authors = [ "Kostiantyn Wandalen ", @@ -31,7 +31,7 @@ full = [ "default" ] enabled = [ "mod_interface/enabled", "former/enabled", - "proper_path_tools/enabled", + "pth/enabled", "error_tools/enabled", "iter_tools/enabled", ] @@ -42,7 +42,7 @@ process_environment_is_cicd = [] [dependencies] mod_interface = { workspace = true } former = { workspace = true, features = [ "derive_former" ] } -proper_path_tools = { workspace = true } +pth = { workspace = true } error_tools = { workspace = true, features = [ "error_untyped" ] } iter_tools = { workspace = true } diff --git a/module/core/program_tools/Cargo.toml b/module/core/program_tools/Cargo.toml index 1ba2675334..a5e28c9202 100644 --- a/module/core/program_tools/Cargo.toml +++ b/module/core/program_tools/Cargo.toml @@ -36,7 +36,7 @@ full = [ enabled = [ "mod_interface/enabled", "former/enabled", - "proper_path_tools/enabled", + "pth/enabled", "error_tools/enabled", "iter_tools/enabled", ] @@ -44,7 +44,7 @@ enabled = [ [dependencies] mod_interface = { workspace = true } former = { workspace = true, features = [ "derive_former" ] } -proper_path_tools = { workspace = true } +pth = { workspace = true } error_tools = { workspace = true, features = [ "error_untyped" ] } # qqq : xxx : rid of error_untyped iter_tools = { workspace = true } diff --git a/module/core/proper_path_tools/Readme.md b/module/core/proper_path_tools/Readme.md deleted file mode 100644 index d142018019..0000000000 --- a/module/core/proper_path_tools/Readme.md +++ /dev/null @@ -1,35 +0,0 @@ - - -# Module :: proper_path_tools - - [![experimental](https://raster.shields.io/static/v1?label=&message=experimental&color=orange)](https://github.com/emersion/stability-badges#experimental) [![rust-status](https://github.com/Wandalen/wTools/actions/workflows/module_proper_path_tools_push.yml/badge.svg)](https://github.com/Wandalen/wTools/actions/workflows/module_proper_path_tools_push.yml) [![docs.rs](https://img.shields.io/docsrs/proper_path_tools?color=e3e8f0&logo=docs.rs)](https://docs.rs/proper_path_tools) [![discord](https://img.shields.io/discord/872391416519737405?color=eee&logo=discord&logoColor=eee&label=ask)](https://discord.gg/m3YfbXpUUY) - - -Collection of algorithms and structures to handle paths properly. - -All functions in the crate don't touch file system, but only process paths. - - diff --git a/module/core/proper_path_tools/Cargo.toml b/module/core/pth/Cargo.toml similarity index 87% rename from module/core/proper_path_tools/Cargo.toml rename to module/core/pth/Cargo.toml index abcf335fb3..79a2141441 100644 --- a/module/core/proper_path_tools/Cargo.toml +++ b/module/core/pth/Cargo.toml @@ -1,15 +1,15 @@ [package] -name = "proper_path_tools" -version = "0.11.0" +name = "pth" +version = "0.21.0" edition = "2021" authors = [ "Kostiantyn Wandalen ", ] license = "MIT" readme = "Readme.md" -documentation = "https://docs.rs/proper_path_tools" -repository = "https://github.com/Wandalen/wTools/tree/master/module/core/proper_path_tools" -homepage = "https://github.com/Wandalen/wTools/tree/master/module/core/proper_path_tools" +documentation = "https://docs.rs/pth" +repository = "https://github.com/Wandalen/wTools/tree/master/module/core/pth" +homepage = "https://github.com/Wandalen/wTools/tree/master/module/core/pth" description = """ Collection of algorithms and structures to handle paths properly. """ @@ -35,6 +35,8 @@ full = [ "path_utf8", ] no_std = [] +# qqq : xxx : negate no_std +# use_std = [] use_alloc = [ "no_std" ] enabled = [ "mod_interface/enabled" ] diff --git a/module/core/pth/License b/module/core/pth/License new file mode 100644 index 0000000000..0804aed8e3 --- /dev/null +++ b/module/core/pth/License @@ -0,0 +1,22 @@ +Copyright Kostiantyn Mysnyk and Out of the Box Systems (c) 2021-2024 + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/module/core/pth/Readme.md b/module/core/pth/Readme.md new file mode 100644 index 0000000000..a6f4c2f04d --- /dev/null +++ b/module/core/pth/Readme.md @@ -0,0 +1,51 @@ + + +# Module :: pth + + [![experimental](https://raster.shields.io/static/v1?label=&message=experimental&color=orange)](https://github.com/emersion/stability-badges#experimental) [![rust-status](https://github.com/Wandalen/wTools/actions/workflows/module_pth_push.yml/badge.svg)](https://github.com/Wandalen/wTools/actions/workflows/module_pth_push.yml) [![docs.rs](https://img.shields.io/docsrs/pth?color=e3e8f0&logo=docs.rs)](https://docs.rs/pth) [![discord](https://img.shields.io/discord/872391416519737405?color=eee&logo=discord&logoColor=eee&label=ask)](https://discord.gg/m3YfbXpUUY) + + +Collection of algorithms and structures to handle paths properly. + +All functions in the crate don't touch file system, but only process paths. + +### Type `AbsolutePath` + +The AbsolutePath type ensures that paths are absolute, which helps reduce issues and maintenance costs associated with relative paths. Relative paths can be problematic as they introduce additional variables and complexities, making code analysis, integration, refactoring, and testing more difficult. By using absolute paths, software architecture can be improved, similar to how avoiding global variables can enhance code quality. It is recommended to use relative paths only at the outskirts of an application. + +### Trait `AsPath` + +This trait is used to avoid redundant allocation of memory by providing a reference to a Path. It is implemented only for types that can either be referenced or are references to Path itself. Unlike `TryIntoPath`, it does not allocate memory on the heap. However, `TryIntoPath` is implemented for a wider range of types because it is not restricted from allocating memory. Unlike `AsRef< Path >`, `AsPath` is implemented for a wider number of types, including those that are not directly convertible to a Path using `AsRef`. This is because `AsPath` is designed to provide a more flexible interface for path-like types, accommodating various representations that can logically be treated as paths. + +### Trait `TryIntoPath` + +This trait is used to convert any path-like type into an owned PathBuf. Unlike `TryIntoCowPath`, it always returns an owned PathBuf, so there is no need to differentiate between borrowed and owned paths at runtime. Unlike `AsPath`, it is implemented for a wider range of path-like types, similar to `TryIntoCowPath`. + +### Trait `TryIntoCowPath` + +This trait is designed to avoid redundant memory allocation. Unlike TryIntoPath, it does not allocate memory on the heap if it’s not necessary. Unlike `AsPath`, it is implemented for a wider number of path-like types, similar to TryIntoPath. The drawback is the necessity to differentiate borrowed and owned paths at runtime. + + diff --git a/module/core/pth/src/as_path.rs b/module/core/pth/src/as_path.rs new file mode 100644 index 0000000000..b94a4cf4d4 --- /dev/null +++ b/module/core/pth/src/as_path.rs @@ -0,0 +1,71 @@ +/// Internal namespace. +mod private +{ + #[ allow( unused_imports ) ] + use crate::*; + #[ cfg( feature = "no_std" ) ] + extern crate std; + + use std::path::Path; + + /// A trait for converting various types into a reference to a `Path`. + /// + /// This trait is used to avoid redundant allocation of memory by providing a reference to a `Path`. + /// It is implemented only for types that can either be referenced or are references to `Path` itself. + /// Unlike `TryIntoPath`, it does not allocate memory on the heap. However, `TryIntoPath` is implemented for a wider range of types because it is not restricted from allocating memory. + /// Unlike `AsRef`, `AsPath` is implemented for a wider number of types, including those that are not directly convertible to a `Path` using `AsRef`. + /// This is because `AsPath` is designed to provide a more flexible interface for path-like types, accommodating various representations that can logically be treated as paths. + pub trait AsPath + { + /// Converts the implementing type into a reference to a `Path`. + /// + /// # Returns + /// + /// A reference to a `Path`. + fn as_path( &self ) -> &Path; + } + + /// Implementation of `AsPath` for `str`. + impl AsPath for str + { + fn as_path( &self ) -> &Path + { + Path::new( self ) + } + } + + /// Implementation of `AsPath` for `Path`. + impl AsPath for Path + { + fn as_path( &self ) -> &Path + { + self + } + } + + /// Implementation of `AsPath` for `Utf8Path`. + #[cfg( feature = "path_utf8" )] + impl AsPath for Utf8Path + { + fn as_path( &self ) -> &Path + { + self.as_std_path() + } + } + + /// Blanket implementation of `AsPath` for all types that implement `AsRef`. + impl< T > AsPath for T + where + T : AsRef< Path >, + { + fn as_path( &self ) -> &Path + { + self.as_ref() + } + } +} + +crate::mod_interface! +{ + orphan use AsPath; +} \ No newline at end of file diff --git a/module/core/proper_path_tools/src/lib.rs b/module/core/pth/src/lib.rs similarity index 67% rename from module/core/proper_path_tools/src/lib.rs rename to module/core/pth/src/lib.rs index 297c2aeff8..223020ac00 100644 --- a/module/core/proper_path_tools/src/lib.rs +++ b/module/core/pth/src/lib.rs @@ -1,7 +1,7 @@ #![ cfg_attr( feature = "no_std", no_std ) ] #![ doc( html_logo_url = "https://raw.githubusercontent.com/Wandalen/wTools/master/asset/img/logo_v3_trans_square.png" ) ] #![ doc( html_favicon_url = "https://raw.githubusercontent.com/Wandalen/wTools/alpha/asset/img/logo_v3_trans_square_icon_small_v2.ico" ) ] -#![ doc( html_root_url = "https://docs.rs/proper_path_tools/latest/proper_path_tools/" ) ] +#![ doc( html_root_url = "https://docs.rs/pth/latest/pth/" ) ] #![ doc = include_str!( concat!( env!( "CARGO_MANIFEST_DIR" ), "/", "Readme.md" ) ) ] #[ cfg( feature = "enabled" ) ] @@ -20,12 +20,26 @@ mod_interface! /// Basic functionality. layer path; + /// AsPath trait. + layer as_path; + /// TryIntoPath trait. + layer try_into_path; + /// TryIntoPath trait. + layer try_into_cow_path; + /// Transitive TryFrom and TryInto. layer transitive; #[ cfg( feature = "path_utf8" ) ] own use ::camino::{ Utf8Path, Utf8PathBuf }; + + // #[ cfg( not( feature = "no_std" ) ) ] + // own use ::std::path::{ PathBuf, Path, Component }; + + #[ cfg( not( feature = "no_std" ) ) ] + own use ::std::path::*; + #[ cfg( not( feature = "no_std" ) ) ] - own use ::std::path::{ PathBuf, Path }; + own use ::std::borrow::Cow; } diff --git a/module/core/proper_path_tools/src/path.rs b/module/core/pth/src/path.rs similarity index 95% rename from module/core/proper_path_tools/src/path.rs rename to module/core/pth/src/path.rs index 313fb4fcd9..7907a3268a 100644 --- a/module/core/proper_path_tools/src/path.rs +++ b/module/core/pth/src/path.rs @@ -2,6 +2,8 @@ mod private { + use crate::*; + #[ cfg( feature = "no_std" ) ] extern crate std; @@ -25,7 +27,7 @@ mod private /// # Examples: /// /// ``` - /// use proper_path_tools::path; + /// use pth::path; /// /// assert_eq!( path::is_glob( "file.txt" ), false ); // No glob patterns /// assert_eq!( path::is_glob( "*.txt" ), true ); // Contains unescaped glob character * @@ -110,7 +112,7 @@ mod private /// /// ``` /// use std::path::{ Path, PathBuf }; - /// use proper_path_tools::path as path; + /// use pth::path as path; /// /// let path = Path::new( "/a/b/./c/../d" ); /// let normalized_path = path::normalize( path ); @@ -260,7 +262,7 @@ mod private /// # Examples /// /// ``` - /// use proper_path_tools::path::unique_folder_name; + /// use pth::path::unique_folder_name; /// let folder_name = unique_folder_name().unwrap(); /// println!( "Generated folder name: {}", folder_name ); /// ``` @@ -309,23 +311,22 @@ mod private /// /// ``` /// use std::path::PathBuf; - /// use proper_path_tools::path; + /// use pth::path; /// /// let paths = vec![ PathBuf::from( "a/b/c" ), PathBuf::from( "/d/e" ), PathBuf::from( "f/g" ) ]; - /// let joined = path::join_paths( paths.iter().map( | p | p.as_path() ) ); + /// let joined = path::iter_join( paths.iter().map( | p | p.as_path() ) ); /// assert_eq!( joined, std::path::PathBuf::from( "/d/e/f/g" ) ); /// /// let paths = vec![ PathBuf::from( "" ), PathBuf::from( "a/b" ), PathBuf::from( "" ), PathBuf::from( "c" ), PathBuf::from( "" ) ]; - /// let joined = path::join_paths( paths.iter().map( | p | p.as_path() ) ); + /// let joined = path::iter_join( paths.iter().map( | p | p.as_path() ) ); /// assert_eq!( joined, std::path::PathBuf::from( PathBuf::from( "/a/b/c" ) ) ); /// /// ``` // qqq : make macro paths_join!( ... ) - pub fn join_paths< 'a, I >( paths : I ) -> std::path::PathBuf + pub fn iter_join< 'a ,I, P >( paths : I ) -> PathBuf where - // AsPath : AsRef< std::path::Path >, - // I : Iterator< Item = AsPath >, - I : Iterator< Item = &'a std::path::Path >, + I : Iterator< Item = P >, + P : TryIntoCowPath< 'a >, { #[ cfg( feature = "no_std" ) ] extern crate alloc; @@ -338,8 +339,12 @@ mod private for path in paths { - let mut path = path.to_string_lossy().replace( '\\', "/" ); - path = path.replace( ':', "" ); + // let mut path = path.to_string_lossy().replace( '\\', "/" ); + // qqq : xxx : avoid unwrap + let path = path.try_into_cow_path().unwrap().to_string_lossy().replace( '\\', "/" ); + // qqq : xxx : avoid converting to String, keep it Path + + // path = path.replace( ':', "" ); // qqq : this is a bug let mut added_slah = false; @@ -450,7 +455,7 @@ mod private /// # Examples /// /// ``` - /// use proper_path_tools::path::exts; + /// use pth::path::exts; /// /// let path = "/path/to/file.tar.gz"; /// let extensions = exts( path ); @@ -458,7 +463,7 @@ mod private /// ``` /// /// ``` - /// use proper_path_tools::path::exts; + /// use pth::path::exts; /// /// let empty_path = ""; /// let extensions = exts( empty_path ); @@ -513,7 +518,7 @@ mod private /// /// ``` /// use std::path::PathBuf; - /// use proper_path_tools::path::without_ext; + /// use pth::path::without_ext; /// /// let path = "/path/to/file.txt"; /// let modified_path = without_ext(path); @@ -522,7 +527,7 @@ mod private /// /// ``` /// use std::path::PathBuf; - /// use proper_path_tools::path::without_ext; + /// use pth::path::without_ext; /// /// let empty_path = ""; /// let modified_path = without_ext(empty_path); @@ -592,7 +597,7 @@ mod private /// /// ``` /// use std::path::PathBuf; - /// use proper_path_tools::path::change_ext; + /// use pth::path::change_ext; /// /// let path = "/path/to/file.txt"; /// let modified_path = change_ext( path, "json" ); @@ -601,7 +606,7 @@ mod private /// /// ``` /// use std::path::PathBuf; - /// use proper_path_tools::path::change_ext; + /// use pth::path::change_ext; /// /// let empty_path = ""; /// let modified_path = change_ext( empty_path, "txt" ); @@ -643,7 +648,7 @@ mod private /// # Examples /// /// ``` - /// use proper_path_tools::path::path_common; + /// use pth::path::path_common; /// /// let paths = vec![ "/a/b/c", "/a/b/d", "/a/b/e" ]; /// let common_path = path_common( paths.into_iter() ); @@ -835,7 +840,7 @@ mod private /// /// let file_path = "/home/user/documents/file.txt"; /// let new_path = "/mnt/storage"; - /// let rebased_path = proper_path_tools::path::rebase( file_path, new_path, None ).unwrap(); + /// let rebased_path = pth::path::rebase( file_path, new_path, None ).unwrap(); /// assert_eq!( rebased_path, PathBuf::from( "/mnt/storage/home/user/documents/file.txt" ) ); /// ``` /// @@ -847,7 +852,7 @@ mod private /// let file_path = "/home/user/documents/file.txt"; /// let new_path = "/mnt/storage"; /// let old_path = "/home/user"; - /// let rebased_path = proper_path_tools::path::rebase( file_path, new_path, Some( old_path ) ).unwrap(); + /// let rebased_path = pth::path::rebase( file_path, new_path, Some( old_path ) ).unwrap(); /// assert_eq!( rebased_path, PathBuf::from( "/mnt/storage/documents/file.txt" ) ); /// ``` /// @@ -901,7 +906,7 @@ mod private /// /// let from = "/a/b"; /// let to = "/a/c/d"; - /// let relative_path = proper_path_tools::path::path_relative( from, to ); + /// let relative_path = pth::path::path_relative( from, to ); /// assert_eq!( relative_path, PathBuf::from( "../c/d" ) ); /// ``` pub fn path_relative< T : AsRef< std::path::Path > >( from : T, to : T ) -> std::path::PathBuf @@ -1009,7 +1014,7 @@ mod private /// # Examples /// /// ``` - /// use proper_path_tools::path::ext; + /// use pth::path::ext; /// /// let path = "/path/to/file.txt"; /// let extension = ext( path ); @@ -1017,7 +1022,7 @@ mod private /// ``` /// /// ``` - /// use proper_path_tools::path::ext; + /// use pth::path::ext; /// /// let empty_path = ""; /// let extension = ext( empty_path ); @@ -1048,17 +1053,20 @@ mod private crate::mod_interface! { - orphan use ext; - orphan use exts; - orphan use change_ext; - orphan use path_relative; - orphan use rebase; - orphan use path_common; - orphan use join_paths; - orphan use without_ext; - orphan use is_glob; - orphan use normalize; - orphan use canonicalize; + orphan use + { + ext, + exts, + change_ext, + path_relative, + rebase, + path_common, + iter_join, + without_ext, + is_glob, + normalize, + canonicalize, + }; #[ cfg( feature = "path_unique_folder_name" ) ] orphan use unique_folder_name; @@ -1072,4 +1080,7 @@ crate::mod_interface! /// Describe native path. Use to pass path to the platfrom. layer native_path; + /// Convenient joining. + layer joining; + } diff --git a/module/core/proper_path_tools/src/path/absolute_path.rs b/module/core/pth/src/path/absolute_path.rs similarity index 54% rename from module/core/proper_path_tools/src/path/absolute_path.rs rename to module/core/pth/src/path/absolute_path.rs index 16fbf3ec78..13a9686207 100644 --- a/module/core/proper_path_tools/src/path/absolute_path.rs +++ b/module/core/pth/src/path/absolute_path.rs @@ -1,55 +1,49 @@ /// Internal namespace. mod private { - use crate::*; - use std:: { - // borrow::Cow, path::{ Path, PathBuf }, io, }; - use core:: { fmt, - ops:: - { - Deref, - DerefMut, - }, + ops::{ Deref, DerefMut }, }; - - #[ cfg( feature="no_std" ) ] + #[ cfg( feature = "no_std" ) ] extern crate std; - - #[ cfg( feature="no_std" ) ] + #[ cfg( feature = "no_std" ) ] use alloc::string::String; - #[ cfg( feature = "derive_serde" ) ] use serde::{ Serialize, Deserialize }; - #[ cfg( feature = "path_utf8" ) ] - use camino::{ Utf8Path, Utf8PathBuf }; + // #[ cfg( feature = "path_utf8" ) ] + // use camino::{ Utf8Path, Utf8PathBuf }; - /// Absolute path. + /// A new type representing an absolute path. + /// + /// The `AbsolutePath` type ensures that paths are absolute, which helps reduce issues and maintenance costs associated with relative paths. + /// Relative paths can be problematic as they introduce additional variables and complexities, making code analysis, integration, refactoring, and testing more difficult. + /// By using absolute paths, software architecture can be improved, similar to how avoiding global variables can enhance code quality. + /// It is recommended to use relative paths only at the outskirts of an application. #[ cfg_attr( feature = "derive_serde", derive( Serialize, Deserialize ) ) ] #[ derive( Debug, Default, Clone, Ord, PartialOrd, Eq, PartialEq, Hash ) ] pub struct AbsolutePath( PathBuf ); impl AbsolutePath { - - /// Returns the Path without its final component, if there is one. - /// Returns None if the path terminates in a root or prefix, or if it's the empty string. + /// Returns the parent directory as an `AbsolutePath`, if it exists. + /// + /// Returns `None` if the path terminates in a root or prefix, or if it's the empty string. #[ inline ] pub fn parent( &self ) -> Option< AbsolutePath > { self.0.parent().map( PathBuf::from ).map( AbsolutePath ) } - /// Creates an owned `AbsolutePath` with path adjoined to self. + /// Creates an owned `AbsolutePath` by joining a given path to `self`. #[ inline ] pub fn join< P >( &self, path : P ) -> AbsolutePath where @@ -58,13 +52,7 @@ mod private Self::try_from( self.0.join( path ) ).unwrap() } - // /// Converts a `AbsolutePath` to a `Cow` - // pub fn to_string_lossy( &self ) -> Cow< '_, str > - // { - // self.0.to_string_lossy() - // } - - /// Determines whether base is a prefix of self. + /// Checks if the path starts with a given base path. /// /// Only considers whole path components to match. #[ inline ] @@ -73,27 +61,52 @@ mod private self.0.starts_with( base ) } - /// Returns inner type which is PathBuf. - #[ inline( always ) ] + /// Returns the inner `PathBuf`. + #[inline(always)] pub fn inner( self ) -> PathBuf { self.0 } - // qqq : xxx : cover by minimal tests - // qqq : xxx : make iterator over Paths also working - /// Joins a list of strs into a single absolute path. - pub fn from_strs< 'a, I >( iter : I ) -> Result< Self, io::Error > + /// Creates an `AbsolutePath` from an iterator over items that implement `TryIntoCowPath`. + /// + /// This function joins all path segments into a single path and attempts to convert it + /// into an `AbsolutePath`. The resulting path must be absolute. + /// + /// # Arguments + /// + /// * `iter` - An iterator over path segments. + /// + /// # Returns + /// + /// * `Ok(AbsolutePath)` if the joined path is absolute. + /// * `Err(io::Error)` if the joined path is not absolute. + pub fn from_iter< 'a, I, P >( iter : I ) -> Result< Self, io::Error > where - I : Iterator< Item = &'a str >, + I : Iterator< Item = P >, + P : TryIntoCowPath< 'a >, { - // Join all the path segments using join_paths - let joined_path = path::join_paths( iter.map( Path::new ) ); - - // Convert the joined PathBuf into an AbsolutePath + let joined_path = iter_join( iter ); AbsolutePath::try_from( joined_path ) } + /// Joins path components into a `PathBuf`. + /// + /// This function leverages the `PathJoined` trait to join multiple path components into a single `PathBuf`. + /// + /// # Arguments + /// + /// * `paths` - A tuple of path components implementing the `PathJoined` trait. + /// + /// # Returns + /// + /// * `Ok(PathBuf)` - The joined path as a `PathBuf`. + /// * `Err(io::Error)` - An error if any component fails to convert. + pub fn from_paths< Paths : PathJoined >( paths : Paths ) -> Result< Self, io::Error > + { + Self::try_from( paths.iter_join()? ) + } + } impl fmt::Display for AbsolutePath @@ -108,8 +121,6 @@ mod private #[ inline ] fn is_absolute( path : &Path ) -> bool { - // None - not absolute - // with `.` or `..` at the first component - not absolute !path.components().next().is_some_and( | c | c.as_os_str() == "." || c.as_os_str() == ".." ) } @@ -135,7 +146,6 @@ mod private } } - // xxx : qqq : use Into< Path > impl TryFrom< &Path > for AbsolutePath { type Error = std::io::Error; @@ -143,13 +153,11 @@ mod private #[ inline ] fn try_from( src : &Path ) -> Result< Self, Self::Error > { - // < Self as TryFrom< &str > >::try_from( src.to_string_lossy() ) let path = path::canonicalize( src )?; - // xxx if !is_absolute( &path ) { - return Err( io::Error::new( io::ErrorKind::InvalidData, "Path expected to be absolute, but it's not {path}" ) ) + return Err( io::Error::new( io::ErrorKind::Other, format!( "Path expected to be absolute, but it's not {path:?}" ) ) ); } Ok( Self( path ) ) @@ -167,19 +175,29 @@ mod private } } -// impl TryFrom< &str > for AbsolutePath -// { -// type Error = std::io::Error; -// // type Error = PathError; -// -// #[ inline( always ) ] -// fn try_from( src : &str ) -> Result< Self, Self::Error > -// { -// Self::try_from( AbsolutePath::try_from( src )? ) -// } -// } - - #[ cfg( feature = "path_utf8" ) ] + impl< 'a > TryFrom< &'a String > for AbsolutePath + { + type Error = std::io::Error; + + #[ inline ] + fn try_from( src : &'a String ) -> Result< Self, Self::Error > + { + < Self as TryFrom< &Path > >::try_from( src.as_ref() ) + } + } + + impl< 'a > TryFrom< String > for AbsolutePath + { + type Error = std::io::Error; + + #[ inline ] + fn try_from( src : String ) -> Result< Self, Self::Error > + { + < Self as TryFrom< &Path > >::try_from( src.as_ref() ) + } + } + + #[cfg( feature = "path_utf8" )] impl TryFrom< Utf8PathBuf > for AbsolutePath { type Error = std::io::Error; @@ -191,7 +209,7 @@ mod private } } - #[ cfg( feature = "path_utf8" ) ] + #[cfg( feature = "path_utf8" )] impl TryFrom< &Utf8PathBuf > for AbsolutePath { type Error = std::io::Error; @@ -203,7 +221,7 @@ mod private } } - #[ cfg( feature = "path_utf8" ) ] + #[cfg( feature = "path_utf8" )] impl TryFrom< &Utf8Path > for AbsolutePath { type Error = std::io::Error; @@ -227,21 +245,18 @@ mod private impl< 'a > TryFrom< &'a AbsolutePath > for &'a str { type Error = std::io::Error; + #[ inline ] fn try_from( src : &'a AbsolutePath ) -> Result< &'a str, Self::Error > { - src - .to_str() - .ok_or_else - ( - move || io::Error::new( io::ErrorKind::Other, format!( "Can't convert &PathBuf into &str {src}" ) ) - ) + src.to_str().ok_or_else( || io::Error::new( io::ErrorKind::Other, format!( "Can't convert &PathBuf into &str {src}" ) ) ) } } impl TryFrom< &AbsolutePath > for String { type Error = std::io::Error; + #[ inline ] fn try_from( src : &AbsolutePath ) -> Result< String, Self::Error > { @@ -250,34 +265,23 @@ mod private } } -// impl TryFrom< Utf8PathBuf > for AbsolutePath -// { -// type Error = std::io::Error; -// -// fn try_from( src : Utf8PathBuf ) -> Result< Self, Self::Error > -// { -// AbsolutePath::try_from( src.as_std_path() ) -// } -// } - -// impl TryFrom< &Utf8Path > for AbsolutePath -// { -// type Error = std::io::Error; -// -// fn try_from( src : &Utf8Path ) -> Result< Self, Self::Error > -// { -// AbsolutePath::try_from( src.as_std_path() ) -// } -// } - - // // xxx : use derives - // impl AsRef< Path > for AbsolutePath - // { - // fn as_ref( &self ) -> &Path - // { - // self.0.as_ref() - // } - // } + impl TryIntoPath for AbsolutePath + { + #[ inline ] + fn try_into_path( self ) -> Result< PathBuf, io::Error > + { + Ok( self.0 ) + } + } + + impl< 'a > TryIntoCowPath< 'a > for AbsolutePath + { + #[ inline ] + fn try_into_cow_path( self ) -> Result< Cow<'a, Path>, io::Error > + { + Ok( Cow::Owned( self.0 ) ) + } + } impl AsRef< Path > for AbsolutePath { @@ -300,6 +304,7 @@ mod private impl Deref for AbsolutePath { type Target = Path; + #[ inline ] fn deref( &self ) -> &Self::Target { @@ -315,42 +320,9 @@ mod private &mut self.0 } } - -// /// Convertable into absolute path entity should implement the trait. -// pub trait TryIntoAbsolutePath -// { -// /// Error returned if conversion is failed. -// type Error; -// /// Method to convert the type into absolute path. -// fn into_absolute_path( self ) -> Result< AbsolutePath, Self::Error >; -// } -// -// // impl TryIntoAbsolutePath for AbsolutePath -// // { -// // type Error = std::io::Error; -// // #[ inline ] -// // fn into_absolute_path( self ) -> Result< AbsolutePath, Self::Error > -// // { -// // Ok( self ) -// // } -// // } -// -// impl< TryIntoAbsolutePathType > TryIntoAbsolutePath for TryIntoAbsolutePathType -// where -// TryIntoAbsolutePathType : TryInto< AbsolutePath >, -// { -// type Error = < Self as TryInto< AbsolutePath > >::Error; -// #[ inline ] -// fn into_absolute_path( self ) -> Result< AbsolutePath, Self::Error > -// { -// self.try_into() -// } -// } - } crate::mod_interface! { exposed use AbsolutePath; - // exposed use TryIntoAbsolutePath; -} +} \ No newline at end of file diff --git a/module/core/proper_path_tools/src/path/canonical_path.rs b/module/core/pth/src/path/canonical_path.rs similarity index 85% rename from module/core/proper_path_tools/src/path/canonical_path.rs rename to module/core/pth/src/path/canonical_path.rs index d6c84168da..b7a871af4d 100644 --- a/module/core/proper_path_tools/src/path/canonical_path.rs +++ b/module/core/pth/src/path/canonical_path.rs @@ -21,6 +21,7 @@ mod private }, }; + // qqq : xxx : redo #[ cfg( feature="no_std" ) ] extern crate std; @@ -30,8 +31,8 @@ mod private #[ cfg( feature = "derive_serde" ) ] use serde::{ Serialize, Deserialize }; - #[ cfg( feature = "path_utf8" ) ] - use camino::{ Utf8Path, Utf8PathBuf }; + // #[ cfg( feature = "path_utf8" ) ] + // use camino::{ Utf8Path, Utf8PathBuf }; /// Caninical path. #[ cfg_attr( feature = "derive_serde", derive( Serialize, Deserialize ) ) ] @@ -114,6 +115,28 @@ mod private } } + impl< 'a > TryFrom< &'a String > for CanonicalPath + { + type Error = std::io::Error; + + #[ inline ] + fn try_from( src : &'a String ) -> Result< Self, Self::Error > + { + < Self as TryFrom< &Path > >::try_from( src.as_ref() ) + } + } + + impl< 'a > TryFrom< String > for CanonicalPath + { + type Error = std::io::Error; + + #[ inline ] + fn try_from( src : String ) -> Result< Self, Self::Error > + { + < Self as TryFrom< &Path > >::try_from( src.as_ref() ) + } + } + impl TryFrom< PathBuf > for CanonicalPath { type Error = std::io::Error; @@ -216,6 +239,32 @@ mod private } } + impl TryIntoPath for CanonicalPath + { + #[ inline ] + fn try_into_path( self ) -> Result< PathBuf, io::Error > + { + Ok( self.0 ) + } + } + + impl< 'a > TryIntoCowPath< 'a > for CanonicalPath + { + #[ inline ] + fn try_into_cow_path( self ) -> Result< Cow<'a, Path>, io::Error > + { + Ok( Cow::Owned( self.0 ) ) + } + } + + // impl AsPath for CanonicalPath + // { + // fn as_path( &self ) -> &Path + // { + // self.0.as_path() + // } + // } + // impl TryFrom< Utf8PathBuf > for CanonicalPath // { // type Error = std::io::Error; diff --git a/module/core/proper_path_tools/src/path/current_path.rs b/module/core/pth/src/path/current_path.rs similarity index 67% rename from module/core/proper_path_tools/src/path/current_path.rs rename to module/core/pth/src/path/current_path.rs index a35c927c0f..cc5fe4aaaa 100644 --- a/module/core/proper_path_tools/src/path/current_path.rs +++ b/module/core/pth/src/path/current_path.rs @@ -4,7 +4,11 @@ mod private use crate::*; #[ cfg( not( feature = "no_std" ) ) ] - use std::env; + use std:: + { + env, + io, + }; /// Symbolize current path. #[ derive( Clone, Copy, Debug, Default, PartialEq, Eq ) ] @@ -48,7 +52,7 @@ mod private env::current_dir() } } - + #[ cfg( not( feature = "no_std" ) ) ] impl TryFrom< CurrentPath > for AbsolutePath { @@ -62,6 +66,39 @@ mod private } } + impl TryIntoPath for &CurrentPath + { + fn try_into_path( self ) -> Result< PathBuf, io::Error > + { + env::current_dir() + } + } + + impl TryIntoPath for CurrentPath + { + fn try_into_path( self ) -> Result< PathBuf, io::Error > + { + env::current_dir() + } + } + + impl< 'a > TryIntoCowPath< 'a > for CurrentPath + { + fn try_into_cow_path( self ) -> Result< Cow<'a, Path>, io::Error > + { + let current_dir = env::current_dir()?; + Ok( Cow::Owned( current_dir ) ) + } + } + + impl< 'a > TryIntoCowPath< 'a > for &CurrentPath + { + fn try_into_cow_path( self ) -> Result< Cow<'a, Path>, io::Error > + { + TryIntoCowPath::try_into_cow_path( *self ) + } + } + } crate::mod_interface! diff --git a/module/core/pth/src/path/joining.rs b/module/core/pth/src/path/joining.rs new file mode 100644 index 0000000000..6e8c0a1ddf --- /dev/null +++ b/module/core/pth/src/path/joining.rs @@ -0,0 +1,191 @@ +mod private +{ + use crate::*; + use std::{ io, path::PathBuf }; + + /// Joins path components into a `PathBuf`. + /// + /// This function leverages the `PathJoined` trait to join multiple path components into a single `PathBuf`. + /// + /// # Arguments + /// + /// * `paths` - A tuple of path components implementing the `PathJoined` trait. + /// + /// # Returns + /// + /// * `Ok(PathBuf)` - The joined path as a `PathBuf`. + /// * `Err(io::Error)` - An error if any component fails to convert. + pub fn join< Paths : PathJoined >( paths : Paths ) -> Result< PathBuf, io::Error > + { + paths.iter_join() + } + + /// A trait for joining path components into a `PathBuf`. + /// + /// This trait provides a method to join multiple path components into a single `PathBuf`. + /// It is implemented for tuples of varying lengths, allowing for flexible combinations of path components. + /// Each component must implement the `TryIntoCowPath` trait, enabling conversion into a `Cow`. + pub trait PathJoined + { + /// Joins the path components into a single `PathBuf`. + /// + /// # Returns + /// + /// * `Ok(PathBuf)` - The joined path as a `PathBuf`. + /// * `Err(io::Error)` - An error if any component fails to convert. + fn iter_join( self ) -> Result< PathBuf, io::Error >; + } + + // // Implementation for an Iterator over items implementing TryIntoCowPath + // impl< 'a, I, T > PathJoined for I + // where + // I : Iterator< Item = T >, + // T : TryIntoCowPath< 'a >, + // { + // fn iter_join( self ) -> Result< PathBuf, io::Error > + // { + // let mut result = PathBuf::new(); + // for item in self + // { + // result.push( item.try_into_cow_path()?.as_ref() ); + // } + // Ok( result ) + // } + // } + + // Implementation for a tuple of length 1 + impl< 'a, T1 > PathJoined for ( T1, ) + where + T1 : TryIntoCowPath< 'a >, + { + #[ inline ] + fn iter_join( self ) -> Result< PathBuf, io::Error > + { + let ( p1, ) = self; + let mut result = PathBuf::new(); + result.push( p1.try_into_cow_path()?.as_ref() ); + Ok( result ) + } + } + + // Implementation for a tuple of length 2 + impl< 'a, T1, T2 > PathJoined for ( T1, T2 ) + where + T1 : TryIntoCowPath< 'a >, + T2 : TryIntoCowPath< 'a >, + { + #[ inline ] + fn iter_join( self ) -> Result< PathBuf, io::Error > + { + let ( p1, p2 ) = self; + let mut result = PathBuf::new(); + result.push( p1.try_into_cow_path()?.as_ref() ); + result.push( p2.try_into_cow_path()?.as_ref() ); + Ok( result ) + } + } + + // Implementation for a tuple of length 3 + impl< 'a, T1, T2, T3 > PathJoined for ( T1, T2, T3 ) + where + T1 : TryIntoCowPath< 'a >, + T2 : TryIntoCowPath< 'a >, + T3 : TryIntoCowPath< 'a >, + { + #[ inline ] + fn iter_join( self ) -> Result< PathBuf, io::Error > + { + let ( p1, p2, p3 ) = self; + let mut result = PathBuf::new(); + result.push( p1.try_into_cow_path()?.as_ref() ); + result.push( p2.try_into_cow_path()?.as_ref() ); + result.push( p3.try_into_cow_path()?.as_ref() ); + Ok( result ) + } + } + + // Implementation for a tuple of length 4 + impl< 'a, T1, T2, T3, T4 > PathJoined for ( T1, T2, T3, T4 ) + where + T1 : TryIntoCowPath< 'a >, + T2 : TryIntoCowPath< 'a >, + T3 : TryIntoCowPath< 'a >, + T4 : TryIntoCowPath< 'a >, + { + #[ inline ] + fn iter_join( self ) -> Result< PathBuf, io::Error > + { + let ( p1, p2, p3, p4 ) = self; + let mut result = PathBuf::new(); + result.push( p1.try_into_cow_path()?.as_ref() ); + result.push( p2.try_into_cow_path()?.as_ref() ); + result.push( p3.try_into_cow_path()?.as_ref() ); + result.push( p4.try_into_cow_path()?.as_ref() ); + Ok( result ) + } + } + + // Implementation for a tuple of length 5 + impl< 'a, T1, T2, T3, T4, T5 > PathJoined for ( T1, T2, T3, T4, T5 ) + where + T1 : TryIntoCowPath< 'a >, + T2 : TryIntoCowPath< 'a >, + T3 : TryIntoCowPath< 'a >, + T4 : TryIntoCowPath< 'a >, + T5 : TryIntoCowPath< 'a >, + { + #[ inline ] + fn iter_join( self ) -> Result< PathBuf, io::Error > + { + let ( p1, p2, p3, p4, p5 ) = self; + let mut result = PathBuf::new(); + result.push( p1.try_into_cow_path()?.as_ref() ); + result.push( p2.try_into_cow_path()?.as_ref() ); + result.push( p3.try_into_cow_path()?.as_ref() ); + result.push( p4.try_into_cow_path()?.as_ref() ); + result.push( p5.try_into_cow_path()?.as_ref() ); + Ok( result ) + } + } + + // Implementation for slices + impl< 'a, T > PathJoined for &'a [ T ] + where + T : TryIntoCowPath< 'a > + Clone, + { + #[ inline ] + fn iter_join( self ) -> Result< PathBuf, io::Error > + { + let mut result = PathBuf::new(); + for item in self + { + result.push( item.clone().try_into_cow_path()?.as_ref() ); + } + Ok( result ) + } + } + + // Implementation for arrays + impl< 'a, T, const N : usize > PathJoined for [ T; N ] + where + T : TryIntoCowPath< 'a > + Clone, + { + #[ inline ] + fn iter_join( self ) -> Result< PathBuf, io::Error > + { + let mut result = PathBuf::new(); + for item in &self + { + result.push( item.clone().try_into_cow_path()?.as_ref() ); + } + Ok( result ) + } + } + +} + +crate::mod_interface! +{ + orphan use join; + exposed use PathJoined; +} diff --git a/module/core/proper_path_tools/src/path/native_path.rs b/module/core/pth/src/path/native_path.rs similarity index 86% rename from module/core/proper_path_tools/src/path/native_path.rs rename to module/core/pth/src/path/native_path.rs index d41b449acc..09dfaaed62 100644 --- a/module/core/proper_path_tools/src/path/native_path.rs +++ b/module/core/pth/src/path/native_path.rs @@ -30,8 +30,8 @@ mod private #[ cfg( feature = "derive_serde" ) ] use serde::{ Serialize, Deserialize }; - #[ cfg( feature = "path_utf8" ) ] - use camino::{ Utf8Path, Utf8PathBuf }; + // #[ cfg( feature = "path_utf8" ) ] + // use camino::{ Utf8Path, Utf8PathBuf }; /// Caninical path. #[ cfg_attr( feature = "derive_serde", derive( Serialize, Deserialize ) ) ] @@ -114,6 +114,28 @@ mod private } } + impl< 'a > TryFrom< &'a String > for NativePath + { + type Error = std::io::Error; + + #[ inline ] + fn try_from( src : &'a String ) -> Result< Self, Self::Error > + { + < Self as TryFrom< &Path > >::try_from( src.as_ref() ) + } + } + + impl< 'a > TryFrom< String > for NativePath + { + type Error = std::io::Error; + + #[ inline ] + fn try_from( src : String ) -> Result< Self, Self::Error > + { + < Self as TryFrom< &Path > >::try_from( src.as_ref() ) + } + } + impl TryFrom< PathBuf > for NativePath { type Error = std::io::Error; @@ -231,6 +253,32 @@ mod private } } + impl TryIntoPath for NativePath + { + #[ inline ] + fn try_into_path( self ) -> Result< PathBuf, io::Error > + { + Ok( self.0 ) + } + } + + impl< 'a > TryIntoCowPath< 'a > for NativePath + { + #[ inline ] + fn try_into_cow_path( self ) -> Result< Cow<'a, Path>, io::Error > + { + Ok( Cow::Owned( self.0 ) ) + } + } + + // impl AsPath for NativePath + // { + // fn as_path( &self ) -> &Path + // { + // self.0.as_path() + // } + // } + // impl TryFrom< Utf8PathBuf > for NativePath // { // type Error = std::io::Error; diff --git a/module/core/proper_path_tools/src/transitive.rs b/module/core/pth/src/transitive.rs similarity index 98% rename from module/core/proper_path_tools/src/transitive.rs rename to module/core/pth/src/transitive.rs index 9de7eef34b..93bbcd3e10 100644 --- a/module/core/proper_path_tools/src/transitive.rs +++ b/module/core/pth/src/transitive.rs @@ -49,7 +49,7 @@ mod private /// # Example /// /// ```rust - /// use proper_path_tools::TransitiveTryFrom; + /// use pth::TransitiveTryFrom; /// use std::convert::TryFrom; /// /// struct InitialType; @@ -132,7 +132,7 @@ mod private /// # Example /// /// ```rust - /// use proper_path_tools::TransitiveTryInto; + /// use pth::TransitiveTryInto; /// use std::convert::TryInto; /// /// struct InitialType; diff --git a/module/core/pth/src/try_into_cow_path.rs b/module/core/pth/src/try_into_cow_path.rs new file mode 100644 index 0000000000..b9f04524ce --- /dev/null +++ b/module/core/pth/src/try_into_cow_path.rs @@ -0,0 +1,111 @@ +/// Internal namespace. +mod private +{ + use crate::*; + use std:: + { + borrow::Cow, + io, + path::{ Component, Path, PathBuf }, + }; + // use camino::{ Utf8Path, Utf8PathBuf }; + + /// A trait for converting various types into a `Cow`. + /// + /// This trait is designed to avoid redundant memory allocation. + /// Unlike `TryIntoPath`, it does not allocate memory on the heap if it's not necessary. + /// Unlike `AsPath`, it is implemented for a wider number of path-like types, similar to `TryIntoPath`. + /// The drawback is the necessity to differentiate borrowed and owned paths at runtime. + pub trait TryIntoCowPath<'a> + { + /// Converts the implementing type into a `Cow`. + /// + /// # Returns + /// + /// * `Ok(Cow)` - A `Cow` that may be either borrowed or owned, depending on the input type. + /// * `Err(io::Error)` - An error if the conversion fails. + fn try_into_cow_path( self ) -> Result< Cow<'a, Path>, io::Error >; + } + + /// Implementation of `TryIntoCowPath` for `String`. + impl<'a> TryIntoCowPath<'a> for &'a str + { + fn try_into_cow_path( self ) -> Result< Cow<'a, Path>, io::Error > + { + Ok( Cow::Borrowed( self.as_path() ) ) + } + } + + /// Implementation of `TryIntoCowPath` for `String`. + impl<'a> TryIntoCowPath<'a> for String + { + fn try_into_cow_path( self ) -> Result< Cow<'a, Path>, io::Error > + { + Ok( Cow::Owned( PathBuf::from( self ) ) ) + } + } + + /// Implementation of `TryIntoCowPath` for `PathBuf`. + impl<'a> TryIntoCowPath<'a> for PathBuf + { + fn try_into_cow_path( self ) -> Result< Cow<'a, Path>, io::Error > + { + Ok( Cow::Owned( self ) ) + } + } + + /// Implementation of `TryIntoCowPath` for a reference to `Path`. + impl<'a> TryIntoCowPath<'a> for &'a Path + { + fn try_into_cow_path( self ) -> Result< Cow<'a, Path>, io::Error > + { + Ok( Cow::Borrowed( self ) ) + } + } + + /// Implementation of `TryIntoCowPath` for a reference to `Utf8Path`. + #[cfg( feature = "path_utf8" )] + impl< 'a > TryIntoCowPath< 'a > for &'a Utf8Path + { + fn try_into_cow_path( self ) -> Result< Cow<'a, Path>, io::Error > + { + Ok( Cow::Borrowed( self.as_std_path() ) ) + } + } + + /// Implementation of `TryIntoCowPath` for `Utf8PathBuf`. + #[cfg( feature = "path_utf8" )] + impl<'a> TryIntoCowPath<'a> for Utf8PathBuf + { + fn try_into_cow_path( self ) -> Result< Cow<'a, Path>, io::Error > + { + Ok( Cow::Owned( self.as_std_path().to_path_buf() ) ) + } + } + + /// Implementation of `TryIntoCowPath` for `std::path::Component`. + impl<'a> TryIntoCowPath<'a> for Component<'a> + { + fn try_into_cow_path( self ) -> Result< Cow<'a, Path>, io::Error > + { + Ok( Cow::Owned( PathBuf::from( self.as_os_str() ) ) ) + } + } + + /// Blanket implementation of `TryIntoCowPath` for references to types implementing `AsPath`. + impl<'a, T> TryIntoCowPath< 'a > for &'a T + where + T : AsPath, + { + fn try_into_cow_path( self ) -> Result< Cow<'a, Path>, io::Error > + { + Ok( Cow::Borrowed( self.as_path() ) ) + } + } + +} + +crate::mod_interface! +{ + orphan use TryIntoCowPath; +} \ No newline at end of file diff --git a/module/core/pth/src/try_into_path.rs b/module/core/pth/src/try_into_path.rs new file mode 100644 index 0000000000..29f508ec1b --- /dev/null +++ b/module/core/pth/src/try_into_path.rs @@ -0,0 +1,109 @@ +/// Internal namespace. +mod private +{ + #[ allow( unused_imports ) ] + use crate::*; + use std:: + { + io, + path::{ Component, Path, PathBuf }, + }; + // use camino::{ Utf8Path, Utf8PathBuf }; + + /// A trait for converting various types into a `PathBuf`. + /// + /// This trait is used to convert any path-like type into an owned `PathBuf`. + /// Unlike `TryIntoCowPath`, it always returns an owned `PathBuf`, so there is no need to differentiate between borrowed and owned paths at runtime. + /// Unlike `AsPath`, it is implemented for a wider range of path-like types, similar to `TryIntoCowPath`. + pub trait TryIntoPath + { + /// Converts the implementing type into a `PathBuf`. + /// + /// # Returns + /// + /// * `Ok(PathBuf)` - The owned path buffer. + /// * `Err(io::Error)` - An error if the conversion fails. + fn try_into_path( self ) -> Result< PathBuf, io::Error >; + } + + /// Implementation of `TryIntoPath` for `&str`. + impl TryIntoPath for &str + { + fn try_into_path( self ) -> Result< PathBuf, io::Error > + { + Ok( PathBuf::from( self ) ) + } + } + + /// Implementation of `TryIntoPath` for `String`. + impl TryIntoPath for String + { + fn try_into_path( self ) -> Result< PathBuf, io::Error > + { + Ok( PathBuf::from( self ) ) + } + } + + /// Implementation of `TryIntoPath` for a reference to `Path`. + impl TryIntoPath for &Path + { + fn try_into_path( self ) -> Result< PathBuf, io::Error > + { + Ok( self.to_path_buf() ) + } + } + + /// Implementation of `TryIntoPath` for `PathBuf`. + impl TryIntoPath for PathBuf + { + fn try_into_path( self ) -> Result< PathBuf, io::Error > + { + Ok( self ) + } + } + + /// Implementation of `TryIntoPath` for a reference to `Utf8Path`. + #[cfg( feature = "path_utf8" )] + impl TryIntoPath for &Utf8Path + { + fn try_into_path( self ) -> Result< PathBuf, io::Error > + { + Ok( self.as_std_path().to_path_buf() ) + } + } + + /// Implementation of `TryIntoPath` for `Utf8PathBuf`. + #[cfg( feature = "path_utf8" )] + impl TryIntoPath for Utf8PathBuf + { + fn try_into_path( self ) -> Result< PathBuf, io::Error > + { + Ok( self.as_std_path().to_path_buf() ) + } + } + + /// Implementation of `TryIntoPath` for `std::path::Component`. + impl TryIntoPath for Component<'_> + { + fn try_into_path( self ) -> Result< PathBuf, io::Error > + { + Ok( self.as_os_str().into() ) + } + } + + /// Blanket implementation of `TryIntoPath` for references to types implementing `AsRef`. + impl< T > TryIntoPath for &T + where + T : AsRef< Path >, + { + fn try_into_path( self ) -> Result< PathBuf, io::Error > + { + Ok( self.as_ref().to_path_buf() ) + } + } +} + +crate::mod_interface! +{ + orphan use TryIntoPath; +} \ No newline at end of file diff --git a/module/core/proper_path_tools/tests/experiment.rs b/module/core/pth/tests/experiment.rs similarity index 94% rename from module/core/proper_path_tools/tests/experiment.rs rename to module/core/pth/tests/experiment.rs index 29e2cd3eba..60e36f8879 100644 --- a/module/core/proper_path_tools/tests/experiment.rs +++ b/module/core/pth/tests/experiment.rs @@ -2,7 +2,7 @@ include!( "../../../../module/step/meta/src/module/terminal.rs" ); #[ allow( unused_imports ) ] -use proper_path_tools as the_module; +use pth as the_module; #[ allow( unused_imports ) ] use test_tools::exposed::*; diff --git a/module/core/pth/tests/inc/absolute_path_test.rs b/module/core/pth/tests/inc/absolute_path_test.rs new file mode 100644 index 0000000000..6d15a1fb2b --- /dev/null +++ b/module/core/pth/tests/inc/absolute_path_test.rs @@ -0,0 +1,5 @@ +use super::*; + +mod basic_test; +mod from_paths_test; +mod try_from_test; diff --git a/module/core/proper_path_tools/tests/inc/absolute_path.rs b/module/core/pth/tests/inc/absolute_path_test/basic_test.rs similarity index 93% rename from module/core/proper_path_tools/tests/inc/absolute_path.rs rename to module/core/pth/tests/inc/absolute_path_test/basic_test.rs index 94e4ff2ab2..3f8a254ba0 100644 --- a/module/core/proper_path_tools/tests/inc/absolute_path.rs +++ b/module/core/pth/tests/inc/absolute_path_test/basic_test.rs @@ -1,7 +1,5 @@ -#[ allow( unused_imports ) ] use super::*; -#[ cfg( not( feature="no_std" ) ) ] use the_module:: { AbsolutePath, @@ -9,12 +7,6 @@ use the_module:: PathBuf, }; -#[ cfg( feature="no_std" ) ] -use crate::the_module::AbsolutePath; - -// #[ cfg( feature = "path_utf8" ) ] -// use the_module::Utf8PathBuf; - #[ test ] fn basic() { @@ -75,7 +67,6 @@ fn test_join() assert_eq!( joined_path.to_string_lossy(), "/path/to/some/file.txt" ); } - #[test] fn test_relative_path_try_from_str() { diff --git a/module/core/pth/tests/inc/absolute_path_test/from_paths_test.rs b/module/core/pth/tests/inc/absolute_path_test/from_paths_test.rs new file mode 100644 index 0000000000..3e5bd05dd4 --- /dev/null +++ b/module/core/pth/tests/inc/absolute_path_test/from_paths_test.rs @@ -0,0 +1,92 @@ +use super::*; + +// xxx : make it working + +#[ test ] +fn test_from_paths_single_absolute_segment() +{ + use the_module::AbsolutePath; + use std::convert::TryFrom; + + let segments = vec![ "/single" ]; + let got = AbsolutePath::from_iter( segments.iter().map( |s| *s ) ).unwrap(); + let exp = AbsolutePath::try_from( "/single" ).unwrap(); + + assert_eq!( got, exp ); +} + +#[ test ] +fn test_from_paths_multiple_segments() +{ + use the_module::AbsolutePath; + use std::convert::TryFrom; + + let segments = vec![ "/path", "to", "file" ]; + let got = AbsolutePath::from_iter( segments.iter().map( |s| *s ) ).unwrap(); + let exp = AbsolutePath::try_from( "/path/to/file" ).unwrap(); + + assert_eq!( got, exp ); +} + +#[ test ] +fn test_from_paths_empty_segments() +{ + use the_module::AbsolutePath; + + let segments : Vec< &str > = vec![]; + let result = AbsolutePath::from_iter( segments.iter().map( | s | *s ) ); + + assert!( result.is_err(), "Expected an error for empty segments" ); +} + +#[ test ] +fn test_from_paths_with_dot_segments() +{ + use the_module::AbsolutePath; + use std::convert::TryFrom; + + let segments = vec![ "/path", ".", "to", "file" ]; + let got = AbsolutePath::from_iter( segments.iter().map( |s| *s ) ).unwrap(); + let exp = AbsolutePath::try_from( "/path/to/file" ).unwrap(); + + assert_eq!( got, exp ); +} + +#[ test ] +fn test_from_paths_with_dotdot_segments() +{ + use the_module::AbsolutePath; + use std::convert::TryFrom; + + let segments = vec![ "/path", "to", "..", "file" ]; + let got = AbsolutePath::from_iter( segments.iter().map( |s| *s ) ).unwrap(); + let exp = AbsolutePath::try_from( "/path/file" ).unwrap(); + + assert_eq!( got, exp ); +} + +#[ test ] +fn test_from_paths_with_trailing_slash() +{ + use the_module::AbsolutePath; + use std::convert::TryFrom; + + let segments = vec![ "/path", "to", "file/" ]; + let got = AbsolutePath::from_iter( segments.iter().map( |s| *s ) ).unwrap(); + let exp = AbsolutePath::try_from( "/path/to/file/" ).unwrap(); + + assert_eq!( got, exp ); +} + +#[ test ] +fn test_from_paths_with_mixed_slashes() +{ + use the_module::AbsolutePath; + use std::convert::TryFrom; + + let segments = vec![ "/path\\to", "file" ]; + let got = AbsolutePath::from_iter( segments.iter().map( |s| *s ) ).unwrap(); + let exp = AbsolutePath::try_from( "/path/to/file" ).unwrap(); + + assert_eq!( got, exp ); +} diff --git a/module/core/pth/tests/inc/absolute_path_test/try_from_test.rs b/module/core/pth/tests/inc/absolute_path_test/try_from_test.rs new file mode 100644 index 0000000000..ee1aa2b3a1 --- /dev/null +++ b/module/core/pth/tests/inc/absolute_path_test/try_from_test.rs @@ -0,0 +1,55 @@ +use super::*; +use std::convert::TryFrom; + +#[ test ] +fn try_from_absolute_path_test() +{ + use std::path::{ Path, PathBuf }; + use the_module::AbsolutePath; + + // Create an AbsolutePath instance + let absolute_path = AbsolutePath::try_from( "/absolute/path" ).unwrap(); + + // Test conversion to &str + let path_str : &str = TryFrom::try_from( &absolute_path ).unwrap(); + println!( "&str from AbsolutePath: {:?}", path_str ); + assert_eq!( path_str, "/absolute/path" ); + + // Test conversion to String + let path_string : String = TryFrom::try_from( &absolute_path ).unwrap(); + println!( "String from AbsolutePath: {:?}", path_string ); + assert_eq!( path_string, "/absolute/path" ); + + // Test conversion to PathBuf + let path_buf : PathBuf = TryFrom::try_from( absolute_path.clone() ).unwrap(); + println!( "PathBuf from AbsolutePath: {:?}", path_buf ); + assert_eq!( path_buf, PathBuf::from( "/absolute/path" ) ); + + // Test conversion to &Path + let path_ref : &Path = absolute_path.as_ref(); + println!( "&Path from AbsolutePath: {:?}", path_ref ); + assert_eq!( path_ref, Path::new( "/absolute/path" ) ); + + // Test conversion from &String + let string_path : String = String::from( "/absolute/path" ); + let absolute_path_from_string : AbsolutePath = TryFrom::try_from( &string_path ).unwrap(); + println!( "AbsolutePath from &String: {:?}", absolute_path_from_string ); + assert_eq!( absolute_path_from_string, absolute_path ); + + // Test conversion from String + let absolute_path_from_owned_string : AbsolutePath = TryFrom::try_from( string_path.clone() ).unwrap(); + println!( "AbsolutePath from String: {:?}", absolute_path_from_owned_string ); + assert_eq!( absolute_path_from_owned_string, absolute_path ); + + // Test conversion from &Path + let path_ref : &Path = Path::new( "/absolute/path" ); + let absolute_path_from_path_ref : AbsolutePath = TryFrom::try_from( path_ref ).unwrap(); + println!( "AbsolutePath from &Path: {:?}", absolute_path_from_path_ref ); + assert_eq!( absolute_path_from_path_ref, absolute_path ); + + // Test conversion from PathBuf + let path_buf_instance : PathBuf = PathBuf::from( "/absolute/path" ); + let absolute_path_from_path_buf : AbsolutePath = TryFrom::try_from( path_buf_instance.clone() ).unwrap(); + println!( "AbsolutePath from PathBuf: {:?}", absolute_path_from_path_buf ); + assert_eq!( absolute_path_from_path_buf, absolute_path ); +} \ No newline at end of file diff --git a/module/core/pth/tests/inc/as_path_test.rs b/module/core/pth/tests/inc/as_path_test.rs new file mode 100644 index 0000000000..340a6540ca --- /dev/null +++ b/module/core/pth/tests/inc/as_path_test.rs @@ -0,0 +1,103 @@ +use super::*; + +#[ test ] +fn as_path_test() +{ + use std::path::{ Component, Path, PathBuf }; + #[ cfg( feature = "path_utf8" ) ] + use the_module::{ Utf8Path, Utf8PathBuf }; + use the_module::{ AsPath, AbsolutePath, CanonicalPath, NativePath, CurrentPath }; + + // Test with &str + let path_str : &str = "/some/path"; + let path : &Path = AsPath::as_path( path_str ); + println!( "Path from &str: {:?}", path ); + + // Test with &String + let string_path : String = String::from( "/another/path" ); + let path : &Path = AsPath::as_path( &string_path ); + println!( "Path from &String: {:?}", path ); + + // Test with String + let path : &Path = AsPath::as_path( &string_path ); + println!( "Path from String: {:?}", path ); + + // Test with &Path + let path_ref : &Path = Path::new( "/yet/another/path" ); + let path : &Path = AsPath::as_path( path_ref ); + println!( "Path from &Path: {:?}", path ); + + // Test with &PathBuf + let path_buf : PathBuf = PathBuf::from( "/yet/another/path" ); + let path : &Path = AsPath::as_path( &path_buf ); + println!( "Path from &PathBuf: {:?}", path ); + + // Test with PathBuf + let path : &Path = AsPath::as_path( &path_buf ); + println!( "Path from PathBuf: {:?}", path ); + + // Test with &AbsolutePath + let absolute_path : AbsolutePath = AbsolutePath::try_from( "/absolute/path" ).unwrap(); + let path : &Path = AsPath::as_path( &absolute_path ); + println!( "Path from &AbsolutePath: {:?}", path ); + + // Test with AbsolutePath + let path : &Path = AsPath::as_path( &absolute_path ); + println!( "Path from AbsolutePath: {:?}", path ); + + // Test with &CanonicalPath + let canonical_path = CanonicalPath::try_from( "/canonical/path" ).unwrap(); + let path : &Path = AsPath::as_path( &canonical_path ); + println!( "Path from &CanonicalPath: {:?}", path ); + + // Test with CanonicalPath + let path : &Path = AsPath::as_path( &canonical_path ); + println!( "Path from CanonicalPath: {:?}", path ); + + // Test with &NativePath + let native_path = NativePath::try_from( PathBuf::from( "/native/path" ) ).unwrap(); + let path : &Path = AsPath::as_path( &native_path ); + println!( "Path from &NativePath: {:?}", path ); + + // Test with NativePath + let path : &Path = AsPath::as_path( &native_path ); + println!( "Path from NativePath: {:?}", path ); + + // Test with &Component + let root_component : Component< '_ > = Component::RootDir; + let path : &Path = AsPath::as_path( &root_component ); + println!( "Path from &Component: {:?}", path ); + + // Test with Component + let path : &Path = AsPath::as_path( &root_component ); + println!( "Path from Component: {:?}", path ); + + // Test with Component + let path = Path::new( "/component/path" ); + for component in path.components() + { + let path : &Path = AsPath::as_path( &component ); + println!( "Path from Component: {:?}", path ); + } + + #[ cfg( feature = "path_utf8" ) ] + { + // Test with &Utf8Path + let utf8_path = Utf8Path::new( "/utf8/path" ); + let path : &Path = AsPath::as_path( &utf8_path ); + println!( "Path from &Utf8Path: {:?}", path ); + + // Test with Utf8Path + let path : &Path = AsPath::as_path( &utf8_path ); + println!( "Path from Utf8Path: {:?}", path ); + + // Test with &Utf8PathBuf + let utf8_path_buf = Utf8PathBuf::from( "/utf8/pathbuf" ); + let path : &Path = AsPath::as_path( &utf8_path_buf ); + println!( "Path from &Utf8PathBuf: {:?}", path ); + + // Test with Utf8PathBuf + let path : &Path = AsPath::as_path( &utf8_path_buf ); + println!( "Path from Utf8PathBuf: {:?}", path ); + } +} diff --git a/module/core/proper_path_tools/tests/inc/current_path.rs b/module/core/pth/tests/inc/current_path.rs similarity index 100% rename from module/core/proper_path_tools/tests/inc/current_path.rs rename to module/core/pth/tests/inc/current_path.rs diff --git a/module/core/proper_path_tools/tests/inc/mod.rs b/module/core/pth/tests/inc/mod.rs similarity index 57% rename from module/core/proper_path_tools/tests/inc/mod.rs rename to module/core/pth/tests/inc/mod.rs index 58e8721710..8026b293ba 100644 --- a/module/core/proper_path_tools/tests/inc/mod.rs +++ b/module/core/pth/tests/inc/mod.rs @@ -1,8 +1,14 @@ -#[allow(unused_imports)] use super::*; -mod absolute_path; +mod as_path_test; +mod try_into_path_test; +mod try_into_cow_path_test; + +mod absolute_path_test; +mod path_join_fn_test; +mod path_join_trait_test; + mod current_path; mod path_canonicalize; mod path_change_ext; @@ -10,12 +16,11 @@ mod path_common; mod path_ext; mod path_exts; mod path_is_glob; -mod path_join; mod path_normalize; mod path_relative; mod rebase_path; mod transitive; mod without_ext; -#[cfg(feature = "path_unique_folder_name")] +#[ cfg( feature = "path_unique_folder_name" ) ] mod path_unique_folder_name; diff --git a/module/core/proper_path_tools/tests/inc/path_canonicalize.rs b/module/core/pth/tests/inc/path_canonicalize.rs similarity index 100% rename from module/core/proper_path_tools/tests/inc/path_canonicalize.rs rename to module/core/pth/tests/inc/path_canonicalize.rs diff --git a/module/core/proper_path_tools/tests/inc/path_change_ext.rs b/module/core/pth/tests/inc/path_change_ext.rs similarity index 100% rename from module/core/proper_path_tools/tests/inc/path_change_ext.rs rename to module/core/pth/tests/inc/path_change_ext.rs diff --git a/module/core/proper_path_tools/tests/inc/path_common.rs b/module/core/pth/tests/inc/path_common.rs similarity index 100% rename from module/core/proper_path_tools/tests/inc/path_common.rs rename to module/core/pth/tests/inc/path_common.rs diff --git a/module/core/proper_path_tools/tests/inc/path_ext.rs b/module/core/pth/tests/inc/path_ext.rs similarity index 100% rename from module/core/proper_path_tools/tests/inc/path_ext.rs rename to module/core/pth/tests/inc/path_ext.rs diff --git a/module/core/proper_path_tools/tests/inc/path_exts.rs b/module/core/pth/tests/inc/path_exts.rs similarity index 100% rename from module/core/proper_path_tools/tests/inc/path_exts.rs rename to module/core/pth/tests/inc/path_exts.rs diff --git a/module/core/proper_path_tools/tests/inc/path_is_glob.rs b/module/core/pth/tests/inc/path_is_glob.rs similarity index 100% rename from module/core/proper_path_tools/tests/inc/path_is_glob.rs rename to module/core/pth/tests/inc/path_is_glob.rs diff --git a/module/core/proper_path_tools/tests/inc/path_join.rs b/module/core/pth/tests/inc/path_join_fn_test.rs similarity index 76% rename from module/core/proper_path_tools/tests/inc/path_join.rs rename to module/core/pth/tests/inc/path_join_fn_test.rs index fa526ee19d..f5a2acd005 100644 --- a/module/core/proper_path_tools/tests/inc/path_join.rs +++ b/module/core/pth/tests/inc/path_join_fn_test.rs @@ -5,7 +5,7 @@ use std::path::PathBuf; fn join_empty() { let ( expected, paths ) : ( PathBuf, Vec< PathBuf > ) = ( "".into(), vec![ "".into() ] ); - let result = the_module::path::join_paths( paths.iter().map( |p| p.as_path() ) ); + let result = the_module::path::iter_join( paths.iter().map( |p| p.as_path() ) ); assert_eq! ( result, @@ -21,7 +21,7 @@ fn join_empty() fn join_several_empties() { let ( expected, paths ) : ( PathBuf, Vec< PathBuf > ) = ( "".into(), vec![ "".into(), "".into() ] ); - let result = the_module::path::join_paths( paths.iter().map( |p| p.as_path() ) ); + let result = the_module::path::iter_join( paths.iter().map( |p| p.as_path() ) ); assert_eq! ( result, @@ -37,7 +37,7 @@ fn join_several_empties() fn root_with_absolute() { let ( expected, paths ) : ( PathBuf, Vec< PathBuf > ) = ( "/a/b".into(), vec![ "/".into(), "/a/b".into() ] ); - let result = the_module::path::join_paths( paths.iter().map( |p| p.as_path() ) ); + let result = the_module::path::iter_join( paths.iter().map( |p| p.as_path() ) ); assert_eq! ( result, @@ -53,7 +53,7 @@ fn root_with_absolute() fn root_with_relative() { let ( expected, paths ) : ( PathBuf, Vec< PathBuf > ) = ( "/a/b".into(), vec![ "/".into(), "a/b".into() ] ); - let result = the_module::path::join_paths( paths.iter().map( |p| p.as_path() ) ); + let result = the_module::path::iter_join( paths.iter().map( |p| p.as_path() ) ); assert_eq! ( result, @@ -69,7 +69,7 @@ fn root_with_relative() fn dir_with_absolute() { let ( expected, paths ) : ( PathBuf, Vec< PathBuf > ) = ( "/a/b".into(), vec![ "/dir".into(), "/a/b".into() ] ); - let result = the_module::path::join_paths( paths.iter().map( |p| p.as_path() ) ); + let result = the_module::path::iter_join( paths.iter().map( |p| p.as_path() ) ); assert_eq! ( result, @@ -85,7 +85,7 @@ fn dir_with_absolute() fn dir_with_relative() { let ( expected, paths ) : ( PathBuf, Vec< PathBuf > ) = ( "/dir/a/b".into(), vec![ "/dir".into(), "a/b".into() ] ); - let result = the_module::path::join_paths( paths.iter().map( |p| p.as_path() ) ); + let result = the_module::path::iter_join( paths.iter().map( |p| p.as_path() ) ); assert_eq! ( result, @@ -101,7 +101,7 @@ fn dir_with_relative() fn trailed_dir_with_absolute() { let ( expected, paths ) : ( PathBuf, Vec< PathBuf > ) = ( "/a/b".into(), vec![ "/dir/".into(), "/a/b".into() ] ); - let result = the_module::path::join_paths( paths.iter().map( |p| p.as_path() ) ); + let result = the_module::path::iter_join( paths.iter().map( |p| p.as_path() ) ); assert_eq! ( result, @@ -117,7 +117,7 @@ fn trailed_dir_with_absolute() fn trailed_dir_with_relative() { let ( expected, paths ) : ( PathBuf, Vec< PathBuf > ) = ( "/dir/a/b".into(), vec![ "/dir/".into(), "a/b".into() ] ); - let result = the_module::path::join_paths( paths.iter().map( |p| p.as_path() ) ); + let result = the_module::path::iter_join( paths.iter().map( |p| p.as_path() ) ); assert_eq! ( result, @@ -133,7 +133,7 @@ fn trailed_dir_with_relative() fn dir_with_down() { let ( expected, paths ) : ( PathBuf, Vec< PathBuf > ) = ( "/a/b".into(), vec![ "/dir".into(), "../a/b".into() ] ); - let result = the_module::path::join_paths( paths.iter().map( |p| p.as_path() ) ); + let result = the_module::path::iter_join( paths.iter().map( |p| p.as_path() ) ); assert_eq! ( result, @@ -149,7 +149,7 @@ fn dir_with_down() fn trailed_dir_with_down() { let ( expected, paths ) : ( PathBuf, Vec< PathBuf > ) = ( "/dir/a/b".into(), vec![ "/dir/".into(), "../a/b".into() ] ); - let result = the_module::path::join_paths( paths.iter().map( |p| p.as_path() ) ); + let result = the_module::path::iter_join( paths.iter().map( |p| p.as_path() ) ); assert_eq! ( result, @@ -165,7 +165,7 @@ fn trailed_dir_with_down() fn dir_with_several_down() { let ( expected, paths ) : ( PathBuf, Vec< PathBuf > ) = ( "/a/b".into(), vec![ "/dir/dir2".into(), "../../a/b".into() ] ); - let result = the_module::path::join_paths( paths.iter().map( |p| p.as_path() ) ); + let result = the_module::path::iter_join( paths.iter().map( |p| p.as_path() ) ); assert_eq! ( result, @@ -181,7 +181,7 @@ fn dir_with_several_down() fn trailed_dir_with_several_down() { let ( expected, paths ) : ( PathBuf, Vec< PathBuf > ) = ( "/a/b".into(), vec![ "/dir/".into(), "../../a/b".into() ] ); - let result = the_module::path::join_paths( paths.iter().map( |p| p.as_path() ) ); + let result = the_module::path::iter_join( paths.iter().map( |p| p.as_path() ) ); assert_eq! ( result, @@ -197,7 +197,7 @@ fn trailed_dir_with_several_down() fn dir_with_several_down_go_out_of_root() { let ( expected, paths ) : ( PathBuf, Vec< PathBuf > ) = ( "/../a/b".into(), vec![ "/dir".into(), "../../a/b".into() ] ); - let result = the_module::path::join_paths( paths.iter().map( |p| p.as_path() ) ); + let result = the_module::path::iter_join( paths.iter().map( |p| p.as_path() ) ); assert_eq! ( result, @@ -213,7 +213,7 @@ fn dir_with_several_down_go_out_of_root() fn trailed_absolute_with_trailed_down() { let ( expected, paths ) : ( PathBuf, Vec< PathBuf > ) = ( "/a/b/".into(), vec![ "/a/b/".into(), "../".into() ] ); - let result = the_module::path::join_paths( paths.iter().map( |p| p.as_path() ) ); + let result = the_module::path::iter_join( paths.iter().map( |p| p.as_path() ) ); assert_eq! ( result, @@ -229,7 +229,7 @@ fn trailed_absolute_with_trailed_down() fn absolute_with_trailed_down() { let ( expected, paths ) : ( PathBuf, Vec< PathBuf > ) = ( "/a/".into(), vec![ "/a/b".into(), "../".into() ] ); - let result = the_module::path::join_paths( paths.iter().map( |p| p.as_path() ) ); + let result = the_module::path::iter_join( paths.iter().map( |p| p.as_path() ) ); assert_eq! ( result, @@ -245,7 +245,7 @@ fn absolute_with_trailed_down() fn trailed_absolute_with_down() { let ( expected, paths ) : ( PathBuf, Vec< PathBuf > ) = ( "/a/b".into(), vec![ "/a/b/".into(), "..".into() ] ); - let result = the_module::path::join_paths( paths.iter().map( |p| p.as_path() ) ); + let result = the_module::path::iter_join( paths.iter().map( |p| p.as_path() ) ); assert_eq! ( result, @@ -261,7 +261,7 @@ fn trailed_absolute_with_down() fn trailed_absolute_with_trailed_here() { let ( expected, paths ) : ( PathBuf, Vec< PathBuf > ) = ( "/a/b/".into(), vec![ "/a/b/".into(), "./".into() ] ); - let result = the_module::path::join_paths( paths.iter().map( |p| p.as_path() ) ); + let result = the_module::path::iter_join( paths.iter().map( |p| p.as_path() ) ); assert_eq! ( result, @@ -277,7 +277,7 @@ fn trailed_absolute_with_trailed_here() fn absolute_with_trailed_here() { let ( expected, paths ) : ( PathBuf, Vec< PathBuf > ) = ( "/a/b/".into(), vec![ "/a/b".into(), "./".into() ] ); - let result = the_module::path::join_paths( paths.iter().map( |p| p.as_path() ) ); + let result = the_module::path::iter_join( paths.iter().map( |p| p.as_path() ) ); assert_eq! ( result, @@ -293,7 +293,7 @@ fn absolute_with_trailed_here() fn trailed_absolute_with_here() { let ( expected, paths ) : ( PathBuf, Vec< PathBuf > ) = ( "/a/b".into(), vec![ "/a/b/".into(), ".".into() ] ); - let result = the_module::path::join_paths( paths.iter().map( |p| p.as_path() ) ); + let result = the_module::path::iter_join( paths.iter().map( |p| p.as_path() ) ); assert_eq! ( result, @@ -309,7 +309,7 @@ fn trailed_absolute_with_here() fn join_with_empty() { let ( expected, paths ) : ( PathBuf, Vec< PathBuf > ) = ( "/a/b/c".into(), vec![ "".into(), "a/b".into(), "".into(), "c".into(), "".into() ] ); - let result = the_module::path::join_paths( paths.iter().map( |p| p.as_path() ) ); + let result = the_module::path::iter_join( paths.iter().map( |p| p.as_path() ) ); assert_eq! ( result, @@ -324,8 +324,8 @@ fn join_with_empty() #[ test ] fn join_windows_os_paths() { - let ( expected, paths ) : ( PathBuf, Vec< PathBuf > ) = ( "/c/foo/bar/".into(), vec![ "c:\\".into(), "foo\\".into(), "bar\\".into() ] ); - let result = the_module::path::join_paths( paths.iter().map( |p| p.as_path() ) ); + let ( expected, paths ) : ( PathBuf, Vec< PathBuf > ) = ( "/c:/foo/bar/".into(), vec![ "c:\\".into(), "foo\\".into(), "bar\\".into() ] ); + let result = the_module::path::iter_join( paths.iter().map( |p| p.as_path() ) ); assert_eq! ( result, @@ -341,7 +341,7 @@ fn join_windows_os_paths() fn join_unix_os_paths() { let ( expected, paths ) : ( PathBuf, Vec< PathBuf > ) = ( "/baz/foo".into(), vec![ "/bar/".into(), "/baz".into(), "foo/".into(), ".".into() ] ); - let result = the_module::path::join_paths( paths.iter().map( |p| p.as_path() ) ); + let result = the_module::path::iter_join( paths.iter().map( |p| p.as_path() ) ); assert_eq! ( result, @@ -357,7 +357,7 @@ fn join_unix_os_paths() fn join_unix_os_paths_2() { let ( expected, paths ) : ( PathBuf, Vec< PathBuf > ) = ( "/baz/foo/z".into(), vec![ "/bar/".into(), "/baz".into(), "foo/".into(), ".".into(), "z".into() ] ); - let result = the_module::path::join_paths( paths.iter().map( |p| p.as_path() ) ); + let result = the_module::path::iter_join( paths.iter().map( |p| p.as_path() ) ); assert_eq! ( result, @@ -373,7 +373,7 @@ fn join_unix_os_paths_2() fn more_complicated_cases_1() { let ( expected, paths ) : ( PathBuf, Vec< PathBuf > ) = ( "/aa/bb//cc".into(), vec![ "/aa".into(), "bb//".into(), "cc".into() ] ); - let result = the_module::path::join_paths( paths.iter().map( |p| p.as_path() ) ); + let result = the_module::path::iter_join( paths.iter().map( |p| p.as_path() ) ); assert_eq! ( result, @@ -389,7 +389,7 @@ fn more_complicated_cases_1() fn more_complicated_cases_2() { let ( expected, paths ) : ( PathBuf, Vec< PathBuf > ) = ( "/bb/cc".into(), vec![ "/aa".into(), "/bb".into(), "cc".into() ] ); - let result = the_module::path::join_paths( paths.iter().map( |p| p.as_path() ) ); + let result = the_module::path::iter_join( paths.iter().map( |p| p.as_path() ) ); assert_eq! ( result, @@ -405,7 +405,7 @@ fn more_complicated_cases_2() fn more_complicated_cases_3() { let ( expected, paths ) : ( PathBuf, Vec< PathBuf > ) = ( "//aa/bb//cc//".into(), vec![ "//aa".into(), "bb//".into(), "cc//".into() ] ); - let result = the_module::path::join_paths( paths.iter().map( |p| p.as_path() ) ); + let result = the_module::path::iter_join( paths.iter().map( |p| p.as_path() ) ); assert_eq! ( result, @@ -421,7 +421,7 @@ fn more_complicated_cases_3() fn more_complicated_cases_4() { let ( expected, paths ) : ( PathBuf, Vec< PathBuf > ) = ( "/aa/bb//cc".into(), vec![ "/aa".into(), "bb//".into(), "cc".into(), ".".into() ] ); - let result = the_module::path::join_paths( paths.iter().map( |p| p.as_path() ) ); + let result = the_module::path::iter_join( paths.iter().map( |p| p.as_path() ) ); assert_eq! ( result, @@ -437,7 +437,7 @@ fn more_complicated_cases_4() fn more_complicated_cases_5() { let ( expected, paths ) : ( PathBuf, Vec< PathBuf > ) = ( "//b//d/..e".into(), vec![ "/".into(), "a".into(), "//b//".into(), "././c".into(), "../d".into(), "..e".into() ] ); - let result = the_module::path::join_paths( paths.iter().map( |p| p.as_path() ) ); + let result = the_module::path::iter_join( paths.iter().map( |p| p.as_path() ) ); assert_eq! ( result, diff --git a/module/core/pth/tests/inc/path_join_trait_test.rs b/module/core/pth/tests/inc/path_join_trait_test.rs new file mode 100644 index 0000000000..74f302166b --- /dev/null +++ b/module/core/pth/tests/inc/path_join_trait_test.rs @@ -0,0 +1,206 @@ +use super::*; +use std:: +{ + borrow::Cow, + io, + path::{ Path, PathBuf }, +}; + +#[ test ] +fn basic() -> Result< (), io::Error > +{ + use the_module::PathJoined; + use std::path::PathBuf; + + let path1 : &str = "/some"; + let path2 : String = "path".into(); + let path3 : PathBuf = "to/file".into(); + let path4 : &str = "extra"; + let path5 : String = "components".into(); + + // Test with a tuple of length 1 + let joined1 : PathBuf = ( path1, ).iter_join()?; + println!( "Joined PathBuf (1): {:?}", joined1 ); + + // Test with a tuple of length 2 + let joined2 : PathBuf = ( path1, path2.clone() ).iter_join()?; + println!( "Joined PathBuf (2): {:?}", joined2 ); + + // Test with a tuple of length 3 + let joined3 : PathBuf = ( path1, path2.clone(), path3.clone() ).iter_join()?; + println!( "Joined PathBuf (3): {:?}", joined3 ); + + // Test with a tuple of length 4 + let joined4 : PathBuf = ( path1, path2.clone(), path3.clone(), path4 ).iter_join()?; + println!( "Joined PathBuf (4): {:?}", joined4 ); + + // Test with a tuple of length 5 + let joined5 : PathBuf = ( path1, path2, path3, path4, path5 ).iter_join()?; + println!( "Joined PathBuf (5): {:?}", joined5 ); + + Ok( () ) +} + +#[ test ] +fn array_join_paths_test() -> Result< (), io::Error > +{ + use the_module::{ PathJoined, TryIntoCowPath }; + use std::path::PathBuf; + + // Define a slice of path components + let path_components : [ &str; 3 ] = [ "/some", "path", "to/file" ]; + // Join the path components into a PathBuf + let joined : PathBuf = path_components.iter_join()?; + println!( "Joined PathBuf from slice: {:?}", joined ); + let expected = PathBuf::from( "/some/path/to/file" ); + assert_eq!( joined, expected ); + + Ok( () ) +} + +#[ test ] +fn slice_join_paths_test() -> Result< (), io::Error > +{ + use the_module::{ PathJoined, TryIntoCowPath }; + use std::path::PathBuf; + + // Define a slice of path components + let path_components : [ &str; 3 ] = [ "/some", "path", "to/file" ]; + let slice : &[ &str ] = &path_components[ .. ]; + // Join the path components into a PathBuf + let joined : PathBuf = slice.iter_join()?; + println!( "Joined PathBuf from slice: {:?}", joined ); + let expected = PathBuf::from( "/some/path/to/file" ); + assert_eq!( joined, expected ); + + Ok( () ) +} + +#[ test ] +fn all_types() -> Result< (), io::Error > +{ + use std::path::Path; + use the_module::{ AbsolutePath, CanonicalPath, NativePath, CurrentPath }; + use the_module::{ PathJoined, AsPath, TryIntoPath }; + + // AbsolutePath and CurrentPath + { + let absolute_path = AbsolutePath::try_from( "/absolute/path" ).unwrap(); + let current_path = CurrentPath; + let joined = ( absolute_path.clone(), current_path ).iter_join()?; + let expected = current_path.try_into_path()?; + println!( "Joined PathBuf: {:?}", joined ); + assert_eq!( joined, expected ); + } + + // // CurrentPath and AbsolutePath + // { + // let absolute_path = AbsolutePath::try_from( "/absolute/path" ).unwrap(); + // let current_path = CurrentPath; + // let joined = ( current_path, absolute_path.clone() ).iter_join()?; + // let expected = absolute_path.as_path().to_path_buf(); + // println!( "Joined PathBuf: {:?}", joined ); + // assert_eq!( joined, expected ); + // } + // // qqq : qqq2 : for Denys : bad + + // AbsolutePath and Component + { + let absolute_path = AbsolutePath::try_from( "/absolute/path" ).unwrap(); + let component = Path::new( "/component/path" ).components().next().unwrap(); + println!( "component : {component:?}" ); + let joined = ( absolute_path, component ).iter_join()?; + let expected = component.as_path(); + println!( "Joined PathBuf: {:?}", joined ); + assert_eq!( joined, expected ); + } + + // AbsolutePath and &str + { + let absolute_path = AbsolutePath::try_from( "/absolute/path" ).unwrap(); + let path_str : &str = "additional/str"; + let joined = ( absolute_path, path_str ).iter_join()?; + let expected = PathBuf::from( "/absolute/path/additional/str" ); + println!( "Joined PathBuf: {:?}", joined ); + assert_eq!( joined, expected ); + } + + // AbsolutePath and NativePath + { + let absolute_path = AbsolutePath::try_from( "/absolute/path" ).unwrap(); + let native_path = NativePath::try_from( PathBuf::from( "/native/path" ) ).unwrap(); + let joined = ( absolute_path, native_path ).iter_join()?; + let expected = PathBuf::from( "/native/path" ); + println!( "Joined PathBuf: {:?}", joined ); + assert_eq!( joined, expected ); + } + + // AbsolutePath and CanonicalPath + { + let absolute_path = AbsolutePath::try_from( "/absolute/path" ).unwrap(); + let canonical_path = CanonicalPath::try_from( "/canonical/path" ).unwrap(); + let joined = ( absolute_path, canonical_path ).iter_join()?; + let expected = PathBuf::from( "/canonical/path" ); + println!( "Joined PathBuf: {:?}", joined ); + assert_eq!( joined, expected ); + } + + // NativePath and CurrentPath + { + let native_path = NativePath::try_from( PathBuf::from( "/native/path" ) ).unwrap(); + let current_path = CurrentPath; + let joined = ( native_path, current_path ).iter_join()?; + let expected = current_path.try_into_path()?; + println!( "Joined PathBuf: {:?}", joined ); + assert_eq!( joined, expected ); + } + + // CanonicalPath and Component + { + let canonical_path = CanonicalPath::try_from( "/canonical/path" ).unwrap(); + let component = Path::new( "/component/path" ).components().next().unwrap(); + println!( "component : {component:?}" ); + let joined = ( canonical_path, component ).iter_join()?; + let expected = component.as_path(); + // let expected = PathBuf::from( "/canonical/component" ); + println!( "Joined PathBuf: {:?}", joined ); + assert_eq!( joined, expected ); + } + + Ok( () ) +} + +#[ test ] +fn join_function_test() -> Result< (), io::Error > +{ + use the_module::path; + use std::path::PathBuf; + + // Test joining a tuple of path components + let path1 : &str = "/some"; + let path2 : String = "path".into(); + let path3 : PathBuf = "to/file".into(); + + // Use the join function to join the path components + let joined : PathBuf = path::join( ( path1, path2.clone(), path3.clone() ) )?; + println!( "Joined PathBuf: {:?}", joined ); + // Verify the expected outcome + let expected = PathBuf::from( "/some/path/to/file" ); + assert_eq!( joined, expected ); + + // Test joining a tuple of length 2 + let joined : PathBuf = path::join( ( path1, path2.clone() ) )?; + println!( "Joined PathBuf (2 components): {:?}", joined ); + // Verify the expected outcome + let expected = PathBuf::from( "/some/path" ); + assert_eq!( joined, expected ); + + // Test joining a tuple of length 1 + let joined : PathBuf = path::join( ( path1, ) )?; + println!( "Joined PathBuf (1 component): {:?}", joined ); + // Verify the expected outcome + let expected = PathBuf::from( "/some" ); + assert_eq!( joined, expected ); + + Ok( () ) +} \ No newline at end of file diff --git a/module/core/proper_path_tools/tests/inc/path_normalize.rs b/module/core/pth/tests/inc/path_normalize.rs similarity index 100% rename from module/core/proper_path_tools/tests/inc/path_normalize.rs rename to module/core/pth/tests/inc/path_normalize.rs diff --git a/module/core/proper_path_tools/tests/inc/path_relative.rs b/module/core/pth/tests/inc/path_relative.rs similarity index 100% rename from module/core/proper_path_tools/tests/inc/path_relative.rs rename to module/core/pth/tests/inc/path_relative.rs diff --git a/module/core/proper_path_tools/tests/inc/path_unique_folder_name.rs b/module/core/pth/tests/inc/path_unique_folder_name.rs similarity index 100% rename from module/core/proper_path_tools/tests/inc/path_unique_folder_name.rs rename to module/core/pth/tests/inc/path_unique_folder_name.rs diff --git a/module/core/proper_path_tools/tests/inc/rebase_path.rs b/module/core/pth/tests/inc/rebase_path.rs similarity index 100% rename from module/core/proper_path_tools/tests/inc/rebase_path.rs rename to module/core/pth/tests/inc/rebase_path.rs diff --git a/module/core/proper_path_tools/tests/inc/transitive.rs b/module/core/pth/tests/inc/transitive.rs similarity index 96% rename from module/core/proper_path_tools/tests/inc/transitive.rs rename to module/core/pth/tests/inc/transitive.rs index e0b2da7acc..8224024e5b 100644 --- a/module/core/proper_path_tools/tests/inc/transitive.rs +++ b/module/core/pth/tests/inc/transitive.rs @@ -4,7 +4,7 @@ use super::*; #[ test ] fn basic_from() { - use proper_path_tools::TransitiveTryFrom; + use pth::TransitiveTryFrom; use std::convert::TryFrom; struct InitialType; @@ -42,7 +42,7 @@ fn basic_from() #[ test ] fn test_transitive_try_into() { - use proper_path_tools::TransitiveTryInto; + use pth::TransitiveTryInto; // Define NewType1 wrapping a String #[ derive( Debug, PartialEq ) ] diff --git a/module/core/pth/tests/inc/try_into_cow_path_test.rs b/module/core/pth/tests/inc/try_into_cow_path_test.rs new file mode 100644 index 0000000000..73a3910c52 --- /dev/null +++ b/module/core/pth/tests/inc/try_into_cow_path_test.rs @@ -0,0 +1,124 @@ +use super::*; + +#[ test ] +fn try_into_cow_path_test() +{ + use std:: + { + borrow::Cow, + path::{ Component, Path, PathBuf }, + }; + #[ cfg( feature = "path_utf8" ) ] + use the_module::{ Utf8Path, Utf8PathBuf }; + use the_module:: + { + TryIntoCowPath, AbsolutePath, CanonicalPath, NativePath, CurrentPath, + }; + + // Test with &str + let path_str : &str = "/some/path"; + let cow_path : Cow< '_ , Path > = TryIntoCowPath::try_into_cow_path( path_str ).unwrap(); + println!( "Cow from &str: {:?}", cow_path ); + + // Test with &String + let string_path : String = String::from( "/another/path" ); + let cow_path : Cow< '_ , Path > = TryIntoCowPath::try_into_cow_path( &string_path ).unwrap(); + println!( "Cow from &String: {:?}", cow_path ); + + // Test with String + let cow_path : Cow< '_ , Path > = TryIntoCowPath::try_into_cow_path( string_path.clone() ).unwrap(); + println!( "Cow from String: {:?}", cow_path ); + + // Test with &Path + let path : &Path = Path::new( "/yet/another/path" ); + let cow_path : Cow< '_ , Path > = TryIntoCowPath::try_into_cow_path( path ).unwrap(); + println!( "Cow from &Path: {:?}", cow_path ); + + // Test with &PathBuf + let path_buf : PathBuf = PathBuf::from( "/yet/another/path" ); + let cow_path : Cow< '_ , Path > = TryIntoCowPath::try_into_cow_path( &path_buf ).unwrap(); + println!( "Cow from &PathBuf: {:?}", cow_path ); + + // Test with PathBuf + let cow_path : Cow< '_ , Path > = TryIntoCowPath::try_into_cow_path( path_buf.clone() ).unwrap(); + println!( "Cow from PathBuf: {:?}", cow_path ); + + // Test with &AbsolutePath + let absolute_path : AbsolutePath = AbsolutePath::try_from( "/absolute/path" ).unwrap(); + let cow_path : Cow< '_ , Path > = TryIntoCowPath::try_into_cow_path( &absolute_path ).unwrap(); + println!( "Cow from &AbsolutePath: {:?}", cow_path ); + + // Test with AbsolutePath + let cow_path : Cow< '_ , Path > = TryIntoCowPath::try_into_cow_path( absolute_path.clone() ).unwrap(); + println!( "Cow from AbsolutePath: {:?}", cow_path ); + + // Test with &CanonicalPath + let canonical_path = CanonicalPath::try_from( "/canonical/path" ).unwrap(); + let cow_path : Cow< '_ , Path > = TryIntoCowPath::try_into_cow_path( &canonical_path ).unwrap(); + println!( "Cow from &CanonicalPath: {:?}", cow_path ); + + // Test with CanonicalPath + let cow_path : Cow< '_ , Path > = TryIntoCowPath::try_into_cow_path( canonical_path.clone() ).unwrap(); + println!( "Cow from CanonicalPath: {:?}", cow_path ); + + // Test with &NativePath + let native_path = NativePath::try_from( PathBuf::from( "/native/path" ) ).unwrap(); + let cow_path : Cow< '_ , Path > = TryIntoCowPath::try_into_cow_path( &native_path ).unwrap(); + println!( "Cow from &NativePath: {:?}", cow_path ); + + // Test with NativePath + let cow_path : Cow< '_ , Path > = TryIntoCowPath::try_into_cow_path( native_path.clone() ).unwrap(); + println!( "Cow from NativePath: {:?}", cow_path ); + + // Test with &CurrentPath + let current_path = CurrentPath; + let cow_path : Cow< '_ , Path > = TryIntoCowPath::try_into_cow_path( ¤t_path ).unwrap(); + println!( "Cow from &CurrentPath: {:?}", cow_path ); + assert!( cow_path.to_string_lossy().len() > 1 ); + + // Test with CurrentPath + let cow_path : Cow< '_ , Path > = TryIntoCowPath::try_into_cow_path( current_path ).unwrap(); + println!( "Cow from CurrentPath: {:?}", cow_path ); + assert!( cow_path.to_string_lossy().len() > 1 ); + + // Test with &Component + let root_component : Component< '_ > = Component::RootDir; + let cow_path : Cow< '_ , Path > = TryIntoCowPath::try_into_cow_path( &root_component ).unwrap(); + println!( "Cow from &Component: {:?}", cow_path ); + assert!( cow_path.to_string_lossy().len() >= 1 ); + + // Test with Component + let cow_path : Cow< '_ , Path > = TryIntoCowPath::try_into_cow_path( root_component ).unwrap(); + println!( "Cow from Component: {:?}", cow_path ); + assert!( cow_path.to_string_lossy().len() >= 1 ); + + // Test with Component + let path = Path::new( "/component/path" ); + for component in path.components() + { + let cow_path : Cow< '_ , Path > = TryIntoCowPath::try_into_cow_path( component ).unwrap(); + println!( "Cow from Component: {:?}", cow_path ); + assert!( cow_path.to_string_lossy().len() >= 1 ); + } + + #[ cfg( feature = "path_utf8" ) ] + { + // Test with &Utf8Path + let utf8_path = Utf8Path::new( "/utf8/path" ); + let cow_path : Cow< '_ , Path > = TryIntoCowPath::try_into_cow_path( &utf8_path ).unwrap(); + println!( "Cow from &Utf8Path: {:?}", cow_path ); + + // Test with Utf8Path + let cow_path : Cow< '_ , Path > = TryIntoCowPath::try_into_cow_path( utf8_path ).unwrap(); + println!( "Cow from Utf8Path: {:?}", cow_path ); + + // Test with &Utf8PathBuf + let utf8_path_buf = Utf8PathBuf::from( "/utf8/pathbuf" ); + let cow_path : Cow< '_ , Path > = TryIntoCowPath::try_into_cow_path( &utf8_path_buf ).unwrap(); + println!( "Cow from &Utf8PathBuf: {:?}", cow_path ); + + // Test with Utf8PathBuf + let cow_path : Cow< '_ , Path > = TryIntoCowPath::try_into_cow_path( utf8_path_buf.clone() ).unwrap(); + println!( "Cow from Utf8PathBuf: {:?}", cow_path ); + } +} diff --git a/module/core/pth/tests/inc/try_into_path_test.rs b/module/core/pth/tests/inc/try_into_path_test.rs new file mode 100644 index 0000000000..b7623d5c60 --- /dev/null +++ b/module/core/pth/tests/inc/try_into_path_test.rs @@ -0,0 +1,117 @@ +use super::*; + +#[ test ] +fn try_into_path_test() +{ + use std::path::{ Component, Path, PathBuf }; + #[ cfg( feature = "path_utf8" ) ] + use the_module::{ Utf8Path, Utf8PathBuf }; + use the_module::{ TryIntoPath, AbsolutePath, CanonicalPath, NativePath, CurrentPath }; + + // Test with &str + let path_str : &str = "/some/path"; + let path_buf : PathBuf = TryIntoPath::try_into_path( path_str ).unwrap(); + println!( "PathBuf from &str: {:?}", path_buf ); + + // Test with &String + let string_path : String = String::from( "/another/path" ); + let path_buf : PathBuf = TryIntoPath::try_into_path( &string_path ).unwrap(); + println!( "PathBuf from &String: {:?}", path_buf ); + + // Test with String + let path_buf : PathBuf = TryIntoPath::try_into_path( string_path.clone() ).unwrap(); + println!( "PathBuf from String: {:?}", path_buf ); + + // Test with &Path + let path : &Path = Path::new( "/yet/another/path" ); + let path_buf : PathBuf = TryIntoPath::try_into_path( path ).unwrap(); + println!( "PathBuf from &Path: {:?}", path_buf ); + + // Test with &PathBuf + let path_buf_instance : PathBuf = PathBuf::from( "/yet/another/path" ); + let path_buf : PathBuf = TryIntoPath::try_into_path( &path_buf_instance ).unwrap(); + println!( "PathBuf from &PathBuf: {:?}", path_buf ); + + // Test with PathBuf + let path_buf : PathBuf = TryIntoPath::try_into_path( path_buf_instance.clone() ).unwrap(); + println!( "PathBuf from PathBuf: {:?}", path_buf ); + + // Test with &AbsolutePath + let absolute_path : AbsolutePath = AbsolutePath::try_from( "/absolute/path" ).unwrap(); + let path_buf : PathBuf = TryIntoPath::try_into_path( &absolute_path ).unwrap(); + println!( "PathBuf from &AbsolutePath: {:?}", path_buf ); + + // Test with AbsolutePath + let path_buf : PathBuf = TryIntoPath::try_into_path( absolute_path.clone() ).unwrap(); + println!( "PathBuf from AbsolutePath: {:?}", path_buf ); + + // Test with &CanonicalPath + let canonical_path = CanonicalPath::try_from( "/canonical/path" ).unwrap(); + let path_buf : PathBuf = TryIntoPath::try_into_path( &canonical_path ).unwrap(); + println!( "PathBuf from &CanonicalPath: {:?}", path_buf ); + + // Test with CanonicalPath + let path_buf : PathBuf = TryIntoPath::try_into_path( canonical_path.clone() ).unwrap(); + println!( "PathBuf from CanonicalPath: {:?}", path_buf ); + + // Test with &NativePath + let native_path = NativePath::try_from( PathBuf::from( "/native/path" ) ).unwrap(); + let path_buf : PathBuf = TryIntoPath::try_into_path( &native_path ).unwrap(); + println!( "PathBuf from &NativePath: {:?}", path_buf ); + + // Test with NativePath + let path_buf : PathBuf = TryIntoPath::try_into_path( native_path.clone() ).unwrap(); + println!( "PathBuf from NativePath: {:?}", path_buf ); + + // Test with &CurrentPath + let current_path = CurrentPath; + let path_buf : PathBuf = TryIntoPath::try_into_path( ¤t_path ).unwrap(); + println!( "PathBuf from &CurrentPath: {:?}", path_buf ); + assert!( path_buf.to_string_lossy().len() > 1 ); + + // Test with CurrentPath + let path_buf : PathBuf = TryIntoPath::try_into_path( current_path ).unwrap(); + println!( "PathBuf from CurrentPath: {:?}", path_buf ); + assert!( path_buf.to_string_lossy().len() > 1 ); + + // Test with &Component + let root_component : Component< '_ > = Component::RootDir; + let path_buf : PathBuf = TryIntoPath::try_into_path( &root_component ).unwrap(); + println!( "PathBuf from &Component: {:?}", path_buf ); + assert!( path_buf.to_string_lossy().len() >= 1 ); + + // Test with Component + let path_buf : PathBuf = TryIntoPath::try_into_path( root_component ).unwrap(); + println!( "PathBuf from Component: {:?}", path_buf ); + assert!( path_buf.to_string_lossy().len() >= 1 ); + + // Test with Component + let path = Path::new( "/component/path" ); + for component in path.components() + { + let path_buf : PathBuf = TryIntoPath::try_into_path( component ).unwrap(); + println!( "PathBuf from Component: {:?}", path_buf ); + assert!( path_buf.to_string_lossy().len() >= 1 ); + } + + #[ cfg( feature = "path_utf8" ) ] + { + // Test with &Utf8Path + let utf8_path = Utf8Path::new( "/utf8/path" ); + let path_buf : PathBuf = TryIntoPath::try_into_path( &utf8_path ).unwrap(); + println!( "PathBuf from &Utf8Path: {:?}", path_buf ); + + // Test with Utf8Path + let path_buf : PathBuf = TryIntoPath::try_into_path( utf8_path ).unwrap(); + println!( "PathBuf from Utf8Path: {:?}", path_buf ); + + // Test with &Utf8PathBuf + let utf8_path_buf = Utf8PathBuf::from( "/utf8/pathbuf" ); + let path_buf : PathBuf = TryIntoPath::try_into_path( &utf8_path_buf ).unwrap(); + println!( "PathBuf from &Utf8PathBuf: {:?}", path_buf ); + + // Test with Utf8PathBuf + let path_buf : PathBuf = TryIntoPath::try_into_path( utf8_path_buf.clone() ).unwrap(); + println!( "PathBuf from Utf8PathBuf: {:?}", path_buf ); + } +} diff --git a/module/core/proper_path_tools/tests/inc/without_ext.rs b/module/core/pth/tests/inc/without_ext.rs similarity index 100% rename from module/core/proper_path_tools/tests/inc/without_ext.rs rename to module/core/pth/tests/inc/without_ext.rs diff --git a/module/core/proper_path_tools/tests/smoke_test.rs b/module/core/pth/tests/smoke_test.rs similarity index 100% rename from module/core/proper_path_tools/tests/smoke_test.rs rename to module/core/pth/tests/smoke_test.rs diff --git a/module/core/pth/tests/tests.rs b/module/core/pth/tests/tests.rs new file mode 100644 index 0000000000..49fa343161 --- /dev/null +++ b/module/core/pth/tests/tests.rs @@ -0,0 +1,9 @@ +#![ allow( unused_imports ) ] + +include!( "../../../../module/step/meta/src/module/terminal.rs" ); + +use pth as the_module; +use test_tools::exposed::*; + +#[ cfg( feature = "enabled" ) ] +mod inc; diff --git a/module/core/strs_tools/Cargo.toml b/module/core/strs_tools/Cargo.toml index 77dd2eeab5..37b6231be0 100644 --- a/module/core/strs_tools/Cargo.toml +++ b/module/core/strs_tools/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "strs_tools" -version = "0.17.0" +version = "0.18.0" edition = "2021" authors = [ "Kostiantyn Wandalen ", diff --git a/module/core/test_tools/Cargo.toml b/module/core/test_tools/Cargo.toml index 2df25d0312..6d30222997 100644 --- a/module/core/test_tools/Cargo.toml +++ b/module/core/test_tools/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "test_tools" -version = "0.10.0" +version = "0.11.0" edition = "2021" authors = [ "Kostiantyn Wandalen ", diff --git a/module/core/test_tools/src/lib.rs b/module/core/test_tools/src/lib.rs index cbac84274c..f9870e775e 100644 --- a/module/core/test_tools/src/lib.rs +++ b/module/core/test_tools/src/lib.rs @@ -43,9 +43,10 @@ pub mod dependency #[ doc( inline ) ] #[ allow( unused_imports ) ] pub use ::process_tools; - #[ doc( inline ) ] - #[ allow( unused_imports ) ] - pub use ::process_tools as process_tools; + + // #[ doc( inline ) ] + // #[ allow( unused_imports ) ] + // pub use ::process_tools as process_tools; } diff --git a/module/core/typing_tools/Cargo.toml b/module/core/typing_tools/Cargo.toml index c61c60c278..2d75db2449 100644 --- a/module/core/typing_tools/Cargo.toml +++ b/module/core/typing_tools/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "typing_tools" -version = "0.9.0" +version = "0.10.0" edition = "2021" authors = [ "Kostiantyn Wandalen ", diff --git a/module/core/variadic_from/Cargo.toml b/module/core/variadic_from/Cargo.toml index 2a67bdda26..073a4f994a 100644 --- a/module/core/variadic_from/Cargo.toml +++ b/module/core/variadic_from/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "variadic_from" -version = "0.24.0" +version = "0.27.0" edition = "2021" authors = [ "Kostiantyn Wandalen ", diff --git a/module/core/wtools/Cargo.toml b/module/core/wtools/Cargo.toml index 8488ccd02b..4d2e2f1f29 100644 --- a/module/core/wtools/Cargo.toml +++ b/module/core/wtools/Cargo.toml @@ -318,7 +318,6 @@ dt_default = [ # "dt_use_std", "data_type/default", "dt_either", - "dt_prelude", # "dt_type_constructor", # "dt_make", # "dt_vectorized_from", @@ -329,7 +328,6 @@ dt_full = [ # "dt_use_std", "data_type/full", "dt_either", - "dt_prelude", # "dt_type_constructor", # "dt_make", # "dt_vectorized_from", @@ -341,7 +339,6 @@ dt_full = [ dt_use_alloc = [ "dt", "data_type/use_alloc" ] dt_either = [ "dt", "data_type/dt_either" ] -dt_prelude = [ "dt", "data_type/dt_prelude" ] # dt_type_constructor = [ "dt", "data_type/dt_type_constructor" ] # dt_make = [ "dt", "data_type/dt_make" ] # dt_vectorized_from = [ "dt", "data_type/dt_vectorized_from" ] diff --git a/module/move/crates_tools/Cargo.toml b/module/move/crates_tools/Cargo.toml index d36a25f270..3f14f8e209 100644 --- a/module/move/crates_tools/Cargo.toml +++ b/module/move/crates_tools/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "crates_tools" -version = "0.13.0" +version = "0.14.0" edition = "2021" authors = [ "Kostiantyn Wandalen ", diff --git a/module/move/unitore/Cargo.toml b/module/move/unitore/Cargo.toml index 8f98fba818..fa560e6cae 100644 --- a/module/move/unitore/Cargo.toml +++ b/module/move/unitore/Cargo.toml @@ -32,7 +32,7 @@ enabled = [] [dependencies] error_tools = { workspace = true, features = [ "default" ] } -proper_path_tools = { workspace = true, features = [ "default" ] } +pth = { workspace = true, features = [ "default" ] } tokio = { version = "1.36.0", features = [ "rt", "rt-multi-thread", "io-std", "macros" ] } hyper = { version = "1.1.0", features = [ "client" ] } hyper-tls = "0.6.0" diff --git a/module/move/unitore/src/action/config.rs b/module/move/unitore/src/action/config.rs index 9dfc356fe0..a2da010f41 100644 --- a/module/move/unitore/src/action/config.rs +++ b/module/move/unitore/src/action/config.rs @@ -16,7 +16,7 @@ use gluesql::{ prelude::Payload, sled_storage::SledStorage }; /// Add configuration file with subscriptions to storage. pub async fn config_add( mut storage : FeedStorage< SledStorage >, path : &PathBuf ) -> Result< impl Report > { - let path = proper_path_tools::path::normalize( path ); + let path = pth::path::normalize( path ); let mut err_str = format!( "Invalid path for config file {:?}", path ); @@ -63,7 +63,7 @@ pub async fn config_add( mut storage : FeedStorage< SledStorage >, path : &PathB /// Remove configuration file from storage. pub async fn config_delete( mut storage : FeedStorage< SledStorage >, path : &PathBuf ) -> Result< impl Report > { - let path = proper_path_tools::path::normalize( path ); + let path = pth::path::normalize( path ); let path = path.canonicalize().context( format!( "Invalid path for config file {:?}", path ) )?; let config = Config::new( path.to_string_lossy().to_string() ); diff --git a/module/move/unitore/src/entity/config.rs b/module/move/unitore/src/entity/config.rs index 92f9f550d6..536c1c5142 100644 --- a/module/move/unitore/src/entity/config.rs +++ b/module/move/unitore/src/entity/config.rs @@ -44,7 +44,7 @@ pub trait ConfigStore // qqq : use AbsolutePath newtype from `path_tools` // qqq : normalize all paths with `path_tools::path::normalize` -// https://docs.rs/proper_path_tools/latest/proper_path_tools/path/fn.normalize.html +// https://docs.rs/pth/latest/pth/path/fn.normalize.html // added path normalization // unitore .query.execute \'SELECT \* FROM feed\' diff --git a/module/move/unitore/tests/config_add.rs b/module/move/unitore/tests/config_add.rs index 7f080622b8..6673b0f608 100644 --- a/module/move/unitore/tests/config_add.rs +++ b/module/move/unitore/tests/config_add.rs @@ -12,7 +12,7 @@ use error_tools::untyped::Result; async fn config_add() -> Result< () > { let path = PathBuf::from( "./tests/fixtures/test_config.toml" ); - let temp_path = proper_path_tools::path::unique_folder_name().unwrap(); + let temp_path = pth::path::unique_folder_name().unwrap(); let config = Config::default() .path( format!( "./{}", temp_path ) ) diff --git a/module/move/unitore/tests/config_delete.rs b/module/move/unitore/tests/config_delete.rs index 9a7ffdf10a..c3393702cc 100644 --- a/module/move/unitore/tests/config_delete.rs +++ b/module/move/unitore/tests/config_delete.rs @@ -16,7 +16,7 @@ async fn config_delete() -> Result< () > { let path = std::path::PathBuf::from( "./tests/fixtures/test_config.toml" ); - let temp_path = proper_path_tools::path::unique_folder_name().unwrap(); + let temp_path = pth::path::unique_folder_name().unwrap(); let config = Config::default() .path( format!( "./{}", temp_path ) ) diff --git a/module/move/unitore/tests/frames_download.rs b/module/move/unitore/tests/frames_download.rs index 11494838f9..0b78b077d0 100644 --- a/module/move/unitore/tests/frames_download.rs +++ b/module/move/unitore/tests/frames_download.rs @@ -2,7 +2,7 @@ use feed_rs::parser as feed_parser; use gluesql:: { core:: - { + { chrono::{ DateTime, Utc }, data::Value }, @@ -20,7 +20,7 @@ use error_tools::untyped::Result; #[ tokio::test ] async fn test_save() -> Result< () > { - let temp_path = proper_path_tools::path::unique_folder_name().unwrap(); + let temp_path = pth::path::unique_folder_name().unwrap(); let config = Config::default() .path( format!( "./{}", temp_path ) ) @@ -52,7 +52,7 @@ async fn test_save() -> Result< () > #[ tokio::test ] async fn test_update() -> Result< () > { - let temp_path = proper_path_tools::path::unique_folder_name().unwrap(); + let temp_path = pth::path::unique_folder_name().unwrap(); let config = Config::default() .path( format!( "./{}", temp_path ) ) diff --git a/module/move/unitore/tests/query_execute.rs b/module/move/unitore/tests/query_execute.rs index 4215971781..0e47c9e576 100644 --- a/module/move/unitore/tests/query_execute.rs +++ b/module/move/unitore/tests/query_execute.rs @@ -41,14 +41,14 @@ fn query_execute() -> Result< () > assert!( res.is_ok() ); // test action - let rt = tokio::runtime::Runtime::new()?; + let rt = tokio::runtime::Runtime::new()?; let ca = CommandsAggregator::former() .command( "query.execute" ) .hint( "hint" ) .long_hint( "long_hint" ) .subject().hint( "SQL query" ).kind( Type::String ).optional( false ).end() .routine( move | o : VerifiedCommand | - { + { let mut f_store = MockStore::new(); f_store .expect_query_execute() @@ -62,19 +62,19 @@ fn query_execute() -> Result< () > ] ) ) ) - ; + ; _ = rt.block_on( async move { let query_arg = o.args .get_owned::< String >( 0 ) ; - + let query_str = query_arg.unwrap(); query::query_execute( f_store, query_str ).await - } ); + } ); } ) .end() - .perform(); + .perform(); let entries = ca.perform( vec![ ".query.execute".to_string(), "SELECT title FROM frame".into() ] ); assert!( entries.is_ok() ); Ok( () ) @@ -84,7 +84,7 @@ fn query_execute() -> Result< () > async fn query_feeds() -> Result< () > { let path = PathBuf::from( "./tests/fixtures/test_config.toml" ); - let temp_path = proper_path_tools::path::unique_folder_name().unwrap(); + let temp_path = pth::path::unique_folder_name().unwrap(); let config = sled::Config::default() .path( format!( "./{}", temp_path ) ) @@ -114,7 +114,7 @@ async fn query_feeds() -> Result< () > #[ tokio::test ] async fn query_frames() -> Result< () > { - let temp_path = proper_path_tools::path::unique_folder_name().unwrap(); + let temp_path = pth::path::unique_folder_name().unwrap(); let config = sled::Config::default() .path( format!( "./{}", temp_path ) ) @@ -160,7 +160,7 @@ async fn query_frames() -> Result< () > async fn query_configs() -> Result< () > { let path = PathBuf::from( "./tests/fixtures/test_config.toml" ); - let temp_path = proper_path_tools::path::unique_folder_name().unwrap(); + let temp_path = pth::path::unique_folder_name().unwrap(); let config = sled::Config::default() .path( format!( "./{}", temp_path ) ) @@ -182,6 +182,6 @@ async fn query_configs() -> Result< () > { assert!( false ); } - + Ok( () ) } diff --git a/module/move/unitore/tests/table_list.rs b/module/move/unitore/tests/table_list.rs index ff06deae00..88b16d519e 100644 --- a/module/move/unitore/tests/table_list.rs +++ b/module/move/unitore/tests/table_list.rs @@ -13,7 +13,7 @@ use error_tools::untyped::Result; #[ tokio::test ] async fn table_list() -> Result< () > { - let temp_path = proper_path_tools::path::unique_folder_name().unwrap(); + let temp_path = pth::path::unique_folder_name().unwrap(); let config = Config::default() .path( format!( "./{}", temp_path ) ) @@ -30,7 +30,7 @@ async fn table_list() -> Result< () > .map( | row | row[ 1 ].clone() ) .collect::< Vec< _ > >() ; - + assert_eq!( column_names.len(), 9 ); assert!( column_names.contains( &Str( String::from( "published") ) ) ); assert!( column_names.contains( &Str( String::from( "authors") ) ) ); diff --git a/module/move/unitore/tests/tables_list.rs b/module/move/unitore/tests/tables_list.rs index f740e94b08..7f5fbb57f7 100644 --- a/module/move/unitore/tests/tables_list.rs +++ b/module/move/unitore/tests/tables_list.rs @@ -9,7 +9,7 @@ use error_tools::untyped::Result; #[ tokio::test ] async fn tables_list() -> Result< () > { - let temp_path = proper_path_tools::path::unique_folder_name().unwrap(); + let temp_path = pth::path::unique_folder_name().unwrap(); let config = Config::default() .path( format!( "./{}", temp_path ) ) diff --git a/module/move/wca/Cargo.toml b/module/move/wca/Cargo.toml index ae882ea833..da8d1227b6 100644 --- a/module/move/wca/Cargo.toml +++ b/module/move/wca/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wca" -version = "0.22.0" +version = "0.23.0" edition = "2021" authors = [ "Kostiantyn Wandalen ", diff --git a/module/move/willbe/Cargo.toml b/module/move/willbe/Cargo.toml index e7152f6149..4f16918129 100644 --- a/module/move/willbe/Cargo.toml +++ b/module/move/willbe/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "willbe" -version = "0.19.0" +version = "0.20.0" edition = "2021" authors = [ "Kostiantyn Wandalen ", @@ -41,7 +41,7 @@ enabled = [ "iter_tools/enabled", "mod_interface/enabled", "wca/enabled", - "proper_path_tools/enabled", + "pth/enabled", "process_tools/enabled", "derive_tools/enabled", "data_type/enabled", @@ -88,7 +88,7 @@ former = { workspace = true, features = [ "default" ] } iter_tools = { workspace = true, features = [ "default" ] } mod_interface = { workspace = true, features = [ "default" ] } wca = { workspace = true, features = [ "default" ] } -proper_path_tools = { workspace = true, features = [ "default", "path_utf8" ] } +pth = { workspace = true, features = [ "default", "path_utf8" ] } process_tools = { workspace = true, features = [ "default" ] } derive_tools = { workspace = true, features = [ "derive_display", "derive_from_str", "derive_deref", "derive_from", "derive_as_ref" ] } data_type = { workspace = true, features = [ "either" ] } diff --git a/module/move/willbe/src/action/readme_modules_headers_renew.rs b/module/move/willbe/src/action/readme_modules_headers_renew.rs index 5370a9d0fa..9b613d97fa 100644 --- a/module/move/willbe/src/action/readme_modules_headers_renew.rs +++ b/module/move/willbe/src/action/readme_modules_headers_renew.rs @@ -179,7 +179,7 @@ mod private &self.module_name ) { - let relative_path = proper_path_tools::path::path_relative + let relative_path = pth::path::path_relative ( workspace_path.try_into().unwrap(), name diff --git a/module/move/willbe/src/tool/path.rs b/module/move/willbe/src/tool/path.rs index c07f0b3d6e..028bbd4189 100644 --- a/module/move/willbe/src/tool/path.rs +++ b/module/move/willbe/src/tool/path.rs @@ -6,7 +6,7 @@ mod private crate::mod_interface! { - use ::proper_path_tools; - own use ::proper_path_tools::own::*; + use ::pth; + own use ::pth::own::*; } diff --git a/module/move/willbe/src/wtools.rs b/module/move/willbe/src/wtools.rs index 1735805c0b..4fe43d10e9 100644 --- a/module/move/willbe/src/wtools.rs +++ b/module/move/willbe/src/wtools.rs @@ -21,8 +21,8 @@ // /// Collection of function and structures to manipulate paths. // pub mod path_tools // { -// // pub use proper_path_tools::own::*; -// // pub use proper_path_tools::own::path; -// // zzz : make use proper_path_tools::own::path working +// // pub use pth::own::*; +// // pub use pth::own::path; +// // zzz : make use pth::own::path working // pub use proper_path::own as path; // } diff --git a/module/postponed/type_constructor/tests/inc/mod.rs b/module/postponed/type_constructor/tests/inc/mod.rs index 199b42411a..da4554b46e 100644 --- a/module/postponed/type_constructor/tests/inc/mod.rs +++ b/module/postponed/type_constructor/tests/inc/mod.rs @@ -8,8 +8,8 @@ use super::*; // mod type_constructor; #[ cfg( feature = "enabled" ) ] -#[ cfg( any( feature = "prelude", feature = "dt_prelude" ) ) ] -mod prelude_test; +// #[ cfg( any( feature = "prelude", feature = "dt_prelude" ) ) ] +// mod prelude_test; // #[ allow( unused_imports ) ] // use super::*; diff --git a/module/postponed/type_constructor/tests/inc/prelude_test.rs b/module/postponed/type_constructor/tests/inc/prelude_test.rs index 4c6ace0d4b..1699fe6b0e 100644 --- a/module/postponed/type_constructor/tests/inc/prelude_test.rs +++ b/module/postponed/type_constructor/tests/inc/prelude_test.rs @@ -1,68 +1,68 @@ -#[ allow( unused_imports ) ] -use super::*; - -// - -#[ cfg( any( not( feature = "no_std" ), feature = "use_alloc" ) ) ] -#[ cfg( feature = "prelude" ) ] -tests_impls! -{ - fn basic() - { - use the_module::prelude::*; - - /* test.case( "Vec" ) */ - let src = Vec::< i32 >::new(); - a_true!( src.is_empty() ); - - /* test.case( "DynList" ) */ - let src = DynList::< i32 >::new(); - a_true!( src.is_empty() ); - - /* test.case( "HashMap" ) */ - let src = HashMap::< i32, i32 >::new(); - a_true!( src.is_empty() ); - - /* test.case( "Map" ) */ - let src = Map::< i32, i32 >::new(); - a_true!( src.is_empty() ); - - /* test.case( "HashSet" ) */ - let src = HashSet::< i32 >::new(); - a_true!( src.is_empty() ); - - /* test.case( "Set" ) */ - let src = Set::< i32 >::new(); - a_true!( src.is_empty() ); - - /* test.case( "BTreeMap" ) */ - let src = BTreeMap::< i32, i32 >::new(); - a_true!( src.is_empty() ); - - /* test.case( "BTreeSet" ) */ - let src = BTreeSet::< i32 >::new(); - a_true!( src.is_empty() ); - - /* test.case( "BinaryHeap" ) */ - let src = BinaryHeap::< i32 >::new(); - a_true!( src.is_empty() ); - - /* test.case( "LinkedList" ) */ - let src = LinkedList::< i32 >::new(); - a_true!( src.is_empty() ); - - /* test.case( "VecDeque" ) */ - let src = VecDeque::< i32 >::new(); - a_true!( src.is_empty() ); - - } -} - -// - -#[ cfg( any( not( feature = "no_std" ), feature = "use_alloc" ) ) ] -#[ cfg( feature = "prelude" ) ] -tests_index! -{ - basic, -} +// #[ allow( unused_imports ) ] +// use super::*; +// +// // +// +// #[ cfg( any( not( feature = "no_std" ), feature = "use_alloc" ) ) ] +// #[ cfg( feature = "prelude" ) ] +// tests_impls! +// { +// fn basic() +// { +// use the_module::prelude::*; +// +// /* test.case( "Vec" ) */ +// let src = Vec::< i32 >::new(); +// a_true!( src.is_empty() ); +// +// /* test.case( "DynList" ) */ +// let src = DynList::< i32 >::new(); +// a_true!( src.is_empty() ); +// +// /* test.case( "HashMap" ) */ +// let src = HashMap::< i32, i32 >::new(); +// a_true!( src.is_empty() ); +// +// /* test.case( "Map" ) */ +// let src = Map::< i32, i32 >::new(); +// a_true!( src.is_empty() ); +// +// /* test.case( "HashSet" ) */ +// let src = HashSet::< i32 >::new(); +// a_true!( src.is_empty() ); +// +// /* test.case( "Set" ) */ +// let src = Set::< i32 >::new(); +// a_true!( src.is_empty() ); +// +// /* test.case( "BTreeMap" ) */ +// let src = BTreeMap::< i32, i32 >::new(); +// a_true!( src.is_empty() ); +// +// /* test.case( "BTreeSet" ) */ +// let src = BTreeSet::< i32 >::new(); +// a_true!( src.is_empty() ); +// +// /* test.case( "BinaryHeap" ) */ +// let src = BinaryHeap::< i32 >::new(); +// a_true!( src.is_empty() ); +// +// /* test.case( "LinkedList" ) */ +// let src = LinkedList::< i32 >::new(); +// a_true!( src.is_empty() ); +// +// /* test.case( "VecDeque" ) */ +// let src = VecDeque::< i32 >::new(); +// a_true!( src.is_empty() ); +// +// } +// } +// +// // +// +// #[ cfg( any( not( feature = "no_std" ), feature = "use_alloc" ) ) ] +// #[ cfg( feature = "prelude" ) ] +// tests_index! +// { +// basic, +// } diff --git a/step/Cargo.toml b/step/Cargo.toml index 70f00c8c96..6e37d39bd0 100644 --- a/step/Cargo.toml +++ b/step/Cargo.toml @@ -21,4 +21,4 @@ all-features = false willbe = { workspace = true, features = [ "full" ] } [dev-dependencies] -test_tools = { workspace = true } +# test_tools = { workspace = true }