22
22
//! makes sense to apply that even to `fn main`. Unfortunately this would
23
23
//! require compiler support to enable, so we've provided an experimental
24
24
//! polyfill for it in the mean time.
25
- //!
26
- //! # Why isn't this crate part of async-std?
27
- //!
28
- //! We want to make sure `async-std`'s surface area is stable, and only includes
29
- //! things that would make sense to be part of "an async version of std".
30
- //! Language level support is really important, but _not_ part of the standard
31
- //! library.
32
- //!
33
- //! This has some distinct benefits: in particular it allows us to
34
- //! version both crates at a different pace. And as features are added to the
35
- //! language (or we decide they weren't a great idea after all), we can
36
- //! incrementally shrink the surface area of this crate.
37
- //!
38
- //! The other big benefit is that it allows libraries to depend on `async-std`
39
- //! without needing to pull in the rather heavy `syn`, `quote`, and
40
- //! `proc-macro2` crates. This should help keep compilation times snappy for
41
- //! everyone.
42
25
43
26
#![ forbid( unsafe_code, future_incompatible, rust_2018_idioms) ]
44
27
#![ deny( missing_debug_implementations, nonstandard_style) ]
@@ -50,12 +33,16 @@ use proc_macro::TokenStream;
50
33
use quote:: { quote, quote_spanned} ;
51
34
use syn:: spanned:: Spanned ;
52
35
53
- /// Defines the async main function.
36
+ /// <span
37
+ /// class="module-item stab portability"
38
+ /// style="display: inline; border-radius: 3px; padding: 2px; font-size: 80%; line-height: 1.2;"
39
+ /// ><code>attributes</code></span>
40
+ /// Enables an async main function.
54
41
///
55
42
/// # Examples
56
43
///
57
44
/// ```ignore
58
- /// #[async_attributes ::main]
45
+ /// #[async_std ::main]
59
46
/// async fn main() -> std::io::Result<()> {
60
47
/// Ok(())
61
48
/// }
@@ -100,12 +87,16 @@ pub fn main(_attr: TokenStream, item: TokenStream) -> TokenStream {
100
87
result. into ( )
101
88
}
102
89
103
- /// Creates an async unit test.
90
+ /// <span
91
+ /// class="module-item stab portability"
92
+ /// style="display: inline; border-radius: 3px; padding: 2px; font-size: 80%; line-height: 1.2;"
93
+ /// ><code>attributes</code></span>
94
+ /// Enables an async test function.
104
95
///
105
96
/// # Examples
106
97
///
107
98
/// ```ignore
108
- /// #[async_attributes ::test]
99
+ /// #[async_std ::test]
109
100
/// async fn my_test() -> std::io::Result<()> {
110
101
/// assert_eq!(2 * 2, 4);
111
102
/// Ok(())
@@ -137,15 +128,19 @@ pub fn test(_attr: TokenStream, item: TokenStream) -> TokenStream {
137
128
result. into ( )
138
129
}
139
130
140
- /// Creates an async benchmark.
131
+ /// <span
132
+ /// class="module-item stab portability"
133
+ /// style="display: inline; border-radius: 3px; padding: 2px; font-size: 80%; line-height: 1.2;"
134
+ /// ><code>attributes</code></span>
135
+ /// Enables an async benchmark function.
141
136
///
142
137
/// # Examples
143
138
///
144
139
/// ```ignore
145
140
/// #![feature(test)]
146
141
/// extern crate test;
147
142
///
148
- /// #[async_attributes ::bench]
143
+ /// #[async_std ::bench]
149
144
/// async fn bench_1(b: &mut test::Bencher) {
150
145
/// b.iter(|| {
151
146
/// println!("hello world");
0 commit comments