arta_tokio/
lib.rs

1//! # arta-tokio
2//! Arta-tokio is a crate that provides an implementation of `arta` abstractions for Tokio runtime.
3//!
4//! ## Installation
5//! Add a following dependencies to your `Cargo.toml`:
6//! ```toml
7//! [dependencies]
8//! arta-tokio = "0.1.0"
9//! arta = "0.1.0"
10//! tokio = { version = "^1", features = ["full"] }
11//! ```
12//! ## Usage
13//!
14//! ```ignore
15//! #[tokio::main]
16//! async fn main() {
17//!     // After tokio runtime was initialized just call methods on `TokioGlobalRuntime` to use
18//!     // this crate.
19//!     // Example:
20//!     let hosts = TokioGlobalRuntime.read_to_string("/etc/hosts").await.unwrap();
21//!     println!("Hosts: {hosts}");
22//! }
23//! ```
24
25#![deny(
26    warnings,
27    clippy::correctness,
28    clippy::suspicious,
29    clippy::complexity,
30    clippy::perf,
31    clippy::style,
32    clippy::pedantic,
33    clippy::restriction,
34    clippy::cargo
35)]
36#![allow(
37    clippy::module_name_repetitions,
38    clippy::blanket_clippy_restriction_lints,
39    clippy::missing_inline_in_public_items,
40    clippy::single_char_lifetime_names,
41    clippy::implicit_return,
42    clippy::pattern_type_mismatch,
43    clippy::question_mark_used,
44    clippy::shadow_reuse,
45    clippy::shadow_same,
46    clippy::pub_with_shorthand,
47    clippy::absolute_paths,
48    clippy::exhaustive_enums,
49    clippy::exhaustive_structs,
50    clippy::multiple_crate_versions,
51    clippy::missing_docs_in_private_items,
52    clippy::pub_use,
53    clippy::infinite_loop, // Allowed because of bug: https://github.com/rust-lang/rust-clippy/issues/12338
54    clippy::unseparated_literal_suffix,
55    clippy::self_named_module_files,
56    clippy::big_endian_bytes,
57    clippy::single_call_fn,
58    clippy::missing_trait_methods,
59    clippy::arithmetic_side_effects,
60    clippy::indexing_slicing,
61    clippy::print_stdout,
62    clippy::shadow_unrelated,
63    clippy::undocumented_unsafe_blocks,
64    clippy::as_conversions,
65    clippy::ref_as_ptr,
66    clippy::doc_markdown,
67    clippy::unwrap_used,
68    clippy::unreachable,
69    clippy::impl_trait_in_params,
70    clippy::missing_errors_doc,
71    clippy::std_instead_of_core,
72    clippy::std_instead_of_alloc,
73    clippy::alloc_instead_of_core,
74    clippy::min_ident_chars
75)]
76#![forbid(unreachable_pub, missing_docs)]
77#![cfg_attr(docsrs, feature(doc_cfg))]
78
79#[cfg(feature = "fs")]
80#[cfg_attr(docsrs, doc(cfg(feature = "fs")))]
81pub mod fs;
82#[cfg(feature = "net")]
83#[cfg_attr(docsrs, doc(cfg(feature = "net")))]
84pub mod net;
85#[cfg(feature = "process")]
86#[cfg_attr(docsrs, doc(cfg(feature = "process")))]
87pub mod process;
88#[cfg(feature = "rt")]
89#[cfg_attr(docsrs, doc(cfg(feature = "rt")))]
90pub mod task;
91#[cfg(feature = "time")]
92mod time;
93
94/// Struct representing tokio global runtime usage.
95pub struct TokioGlobalRuntime;