File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change 51
51
//! serde = "~1"
52
52
//! serde_json = "~1"
53
53
//! ```
54
+ //!
55
+ //! ### Async support with tokio
56
+ //!
57
+ //! The client uses [`reqwest`](https://crates.io/crates/reqwest) to make HTTP calls, which internally uses
58
+ //! the [`tokio`](https://crates.io/crates/tokio) runtime for async support. As such, you may require
59
+ //! to take a dependency on `tokio` in order to use the client. For example, in Cargo.toml, you may
60
+ //! need the following dependency
61
+ //!
62
+ //! ```toml,norun
63
+ //! tokio = { version = "*", features = ["full"] }
64
+ //! ```
65
+ //!
66
+ //! and to attribute async main function with `#[tokio::main]`
67
+ //!
68
+ //! ```rust,norun
69
+ //! #[tokio::main]
70
+ //! async fn main() -> Result<(), Box<dyn std::error::Error>> {
71
+ //! // your code ...
72
+ //! Ok(())
73
+ //! }
74
+ //! ```
75
+ //!
76
+ //! and attribute test functions with `#[tokio::test]`
77
+ //!
78
+ //! ```rust,norun
79
+ //! #[tokio::test]
80
+ //! async fn my_test() -> Result<(), Box<dyn std::error::Error>> {
81
+ //! // your code ...
82
+ //! Ok(())
83
+ //! }
84
+ //! ```
85
+ //!
54
86
//! ## Create a client
55
87
//!
56
88
//! To create a client to make API calls to Elasticsearch running on `http://localhost:9200`
You can’t perform that action at this time.
0 commit comments