Skip to content

Commit d773a55

Browse files
committed
async_tools
1 parent 39be699 commit d773a55

File tree

13 files changed

+314
-7
lines changed

13 files changed

+314
-7
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name : async_from
2+
3+
on :
4+
push :
5+
branches :
6+
- 'alpha'
7+
- 'beta'
8+
- 'master'
9+
10+
11+
env :
12+
CARGO_TERM_COLOR : always
13+
14+
jobs :
15+
16+
# async_from
17+
18+
test :
19+
uses : Wandalen/wTools/.github/workflows/standard_rust_push.yml@alpha
20+
with :
21+
manifest_path : 'module/core/async_from/Cargo.toml'
22+
module_name : 'async_from'
23+
commit_message : ${{ github.event.head_commit.message }}
24+
commiter_username: ${{ github.event.head_commit.committer.username }}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name : async_tools
2+
3+
on :
4+
push :
5+
branches :
6+
- 'alpha'
7+
- 'beta'
8+
- 'master'
9+
10+
11+
env :
12+
CARGO_TERM_COLOR : always
13+
14+
jobs :
15+
16+
# async_tools
17+
18+
test :
19+
uses : Wandalen/wTools/.github/workflows/standard_rust_push.yml@alpha
20+
with :
21+
manifest_path : 'module/core/async_tools/Cargo.toml'
22+
module_name : 'async_tools'
23+
commit_message : ${{ github.event.head_commit.message }}
24+
commiter_username: ${{ github.event.head_commit.committer.username }}

Cargo.toml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -414,12 +414,12 @@ path = "module/alias/wtest_basic"
414414
## async
415415

416416
[workspace.dependencies.async_from]
417-
version = "~0.1.0"
417+
version = "~0.2.0"
418418
path = "module/core/async_from"
419419

420-
# [workspace.dependencies.async_tools]
421-
# version = "~0.1.0"
422-
# path = "module/core/async_tools"
420+
[workspace.dependencies.async_tools]
421+
version = "~0.1.0"
422+
path = "module/core/async_tools"
423423

424424
## graphs tools
425425

@@ -536,3 +536,4 @@ version = "0.1.83"
536536
[workspace.dependencies.tokio]
537537
version = "1.41.0"
538538
features = []
539+
default-features = false

Readme.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ Collection of general purpose tools for solving problems. Fundamentally extend t
4949
| [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) |
5050
| [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) |
5151
| [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) |
52+
| [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) | |
53+
| [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) | |
5254
| [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) |
5355
| [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) | |
5456
| [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) | |

module/core/async_from/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "async_from"
3-
version = "0.1.0"
3+
version = "0.2.0"
44
edition = "2021"
55
authors = [
66
"Kostiantyn Wandalen <[email protected]>",
@@ -35,4 +35,4 @@ async-trait = { workspace = true }
3535

3636
[dev-dependencies]
3737
# test_tools = { workspace = true }
38-
tokio = { workspace = true, default-features = false, features = [ "rt-multi-thread", "time", "macros" ] }
38+
tokio = { workspace = true, features = [ "rt-multi-thread", "time", "macros" ] }

module/core/async_from/src/lib.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ mod private
4747
/// println!( "Converted: {}", num.0 );
4848
/// }
4949
/// ```
50+
#[ cfg( feature = "async_from" ) ]
5051
#[ async_trait ]
5152
pub trait AsyncFrom< T > : Sized
5253
{
@@ -91,6 +92,7 @@ mod private
9192
/// }
9293
/// ```
9394
#[ async_trait ]
95+
#[ cfg( feature = "async_from" ) ]
9496
pub trait AsyncInto< T > : Sized
9597
{
9698
/// Asynchronously converts `Self` into a value of type `T`.
@@ -105,6 +107,7 @@ mod private
105107
///
106108
/// This implementation allows any type `T` that implements `AsyncFrom<U>` to also implement `AsyncInto<U>`.
107109
#[ async_trait ]
110+
#[ cfg( feature = "async_from" ) ]
108111
impl< T, U > AsyncInto< U > for T
109112
where
110113
U : AsyncFrom< T > + Send,
@@ -156,6 +159,7 @@ mod private
156159
/// }
157160
/// ```
158161
#[ async_trait ]
162+
#[ cfg( feature = "async_try_from" ) ]
159163
pub trait AsyncTryFrom< T > : Sized
160164
{
161165
/// The error type returned if the conversion fails.
@@ -209,6 +213,7 @@ mod private
209213
/// }
210214
/// ```
211215
#[ async_trait ]
216+
#[ cfg( feature = "async_try_from" ) ]
212217
pub trait AsyncTryInto< T > : Sized
213218
{
214219
/// The error type returned if the conversion fails.
@@ -226,6 +231,7 @@ mod private
226231
///
227232
/// This implementation allows any type `T` that implements `AsyncTryFrom<U>` to also implement `AsyncTryInto<U>`.
228233
#[ async_trait ]
234+
#[ cfg( feature = "async_try_from" ) ]
229235
impl< T, U > AsyncTryInto< U > for T
230236
where
231237
U : AsyncTryFrom< T > + Send,
@@ -283,14 +289,22 @@ pub mod exposed
283289
pub use prelude::*;
284290

285291
#[ doc( inline ) ]
292+
pub use ::async_trait::async_trait;
293+
294+
#[ cfg( feature = "async_from" ) ]
286295
pub use private::
287296
{
288-
async_trait,
289297
AsyncFrom,
290298
AsyncInto,
299+
};
300+
301+
#[ cfg( feature = "async_try_from" ) ]
302+
pub use private::
303+
{
291304
AsyncTryFrom,
292305
AsyncTryInto,
293306
};
307+
294308
}
295309

296310
/// Prelude to use essentials: `use my_module::prelude::*`.

module/core/async_tools/Cargo.toml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
[package]
2+
name = "async_tools"
3+
version = "0.1.0"
4+
edition = "2021"
5+
authors = [
6+
"Kostiantyn Wandalen <[email protected]>",
7+
]
8+
license = "MIT"
9+
readme = "Readme.md"
10+
documentation = "https://docs.rs/async_tools"
11+
repository = "https://github.com/Wandalen/wTools/tree/master/module/core/async_tools"
12+
homepage = "https://github.com/Wandalen/wTools/tree/master/module/core/async_tools"
13+
description = """
14+
Toolkit for asynchronous programming.
15+
"""
16+
categories = [ "algorithms", "development-tools" ]
17+
keywords = [ "fundamental", "general-purpose" ]
18+
19+
[lints]
20+
workspace = true
21+
22+
[package.metadata.docs.rs]
23+
features = [ "full" ]
24+
all-features = false
25+
26+
[features]
27+
default = [ "enabled", "async_tools", "async_try_from" ]
28+
full = [ "default" ]
29+
enabled = []
30+
async_tools = []
31+
async_try_from = []
32+
33+
[dependencies]
34+
async-trait = { workspace = true }
35+
36+
[dev-dependencies]
37+
# test_tools = { workspace = true }
38+
tokio = { workspace = true, default-features = false, features = [ "rt-multi-thread", "time", "macros" ] }

module/core/async_tools/License

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Copyright Kostiantyn Mysnyk and Out of the Box Systems (c) 2021-2024
2+
3+
Permission is hereby granted, free of charge, to any person
4+
obtaining a copy of this software and associated documentation
5+
files (the "Software"), to deal in the Software without
6+
restriction, including without limitation the rights to use,
7+
copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
copies of the Software, and to permit persons to whom the
9+
Software is furnished to do so, subject to the following
10+
conditions:
11+
12+
The above copyright notice and this permission notice shall be
13+
included in all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22+
OTHER DEALINGS IN THE SOFTWARE.

module/core/async_tools/Readme.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<!-- {{# generate.module_header{} #}} -->
2+
3+
# Module :: async_tools
4+
[![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)
5+
6+
Toolkit for asynchronous programming.

module/core/async_tools/src/lib.rs

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
2+
#![ doc( html_logo_url = "https://raw.githubusercontent.com/Wandalen/wTools/master/asset/img/logo_v3_trans_square.png" ) ]
3+
#![ doc( html_favicon_url = "https://raw.githubusercontent.com/Wandalen/wTools/alpha/asset/img/logo_v3_trans_square_icon_small_v2.ico" ) ]
4+
#![ doc( html_root_url = "https://docs.rs/async_tools/latest/async_tools/" ) ]
5+
#![ doc = include_str!( concat!( env!( "CARGO_MANIFEST_DIR" ), "/", "Readme.md" ) ) ]
6+
7+
/// Namespace with dependencies.
8+
#[ cfg( feature = "enabled" ) ]
9+
pub mod dependency
10+
{
11+
pub use ::async_trait;
12+
pub use ::async_from;
13+
}
14+
15+
/// Internal namespace.
16+
#[ cfg( feature = "enabled" ) ]
17+
mod private
18+
{
19+
}
20+
21+
#[ cfg( feature = "enabled" ) ]
22+
#[ doc( inline ) ]
23+
#[ allow( unused_imports ) ]
24+
pub use own::*;
25+
26+
/// Own namespace of the module.
27+
#[ cfg( feature = "enabled" ) ]
28+
#[ allow( unused_imports ) ]
29+
pub mod own
30+
{
31+
use super::*;
32+
#[ doc( inline ) ]
33+
pub use orphan::*;
34+
35+
#[ doc( inline ) ]
36+
pub use ::async_from::orphan::*;
37+
38+
}
39+
40+
/// Orphan namespace of the module.
41+
#[ cfg( feature = "enabled" ) ]
42+
#[ allow( unused_imports ) ]
43+
pub mod orphan
44+
{
45+
use super::*;
46+
#[ doc( inline ) ]
47+
pub use exposed::*;
48+
49+
}
50+
51+
/// Exposed namespace of the module.
52+
#[ cfg( feature = "enabled" ) ]
53+
#[ allow( unused_imports ) ]
54+
pub mod exposed
55+
{
56+
use super::*;
57+
58+
#[ doc( inline ) ]
59+
pub use prelude::*;
60+
61+
#[ doc( inline ) ]
62+
pub use ::async_trait::async_trait;
63+
64+
#[ doc( inline ) ]
65+
pub use ::async_from::exposed::*;
66+
67+
}
68+
69+
/// Prelude to use essentials: `use my_module::prelude::*`.
70+
#[ cfg( feature = "enabled" ) ]
71+
#[ allow( unused_imports ) ]
72+
pub mod prelude
73+
{
74+
use super::*;
75+
76+
#[ doc( inline ) ]
77+
pub use ::async_from::prelude::*;
78+
79+
}

0 commit comments

Comments
 (0)