diff options
author | Carl Lerche <me@carllerche.com> | 2019-06-27 11:33:36 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-27 11:33:36 -0700 |
commit | 32ceccb4652076629303fda890ad4b2371a0dd02 (patch) | |
tree | d03a913bf7f5e013320a995d8495172c651a1417 /tokio-macros | |
parent | 0af05e7408cef92b834718ed1bd3578fc0fbd40e (diff) |
sync: add async APIs to oneshot and mpsc (#1211)
Adds:
- oneshot::Sender::close
- mpsc::Receiver::recv
- mpsc::Sender::send
Also renames `poll_next` to `poll_recv`.
Refs: #1210
Diffstat (limited to 'tokio-macros')
-rw-r--r-- | tokio-macros/src/lib.rs | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/tokio-macros/src/lib.rs b/tokio-macros/src/lib.rs index 1562b877..c036f552 100644 --- a/tokio-macros/src/lib.rs +++ b/tokio-macros/src/lib.rs @@ -67,12 +67,14 @@ pub fn main(args: TokenStream, item: TokenStream) -> TokenStream { for arg in args { match arg { - syn::NestedMeta::Meta(syn::Meta::Word(ident)) => match ident.to_string().to_lowercase().as_str() { - "multi_thread" => runtime = RuntimeType::Multi, - "single_thread" => runtime = RuntimeType::Single, - name => panic!("Unknown attribute {} is specified", name), - }, - _ => () + syn::NestedMeta::Meta(syn::Meta::Word(ident)) => { + match ident.to_string().to_lowercase().as_str() { + "multi_thread" => runtime = RuntimeType::Multi, + "single_thread" => runtime = RuntimeType::Single, + name => panic!("Unknown attribute {} is specified", name), + } + } + _ => (), } } @@ -90,7 +92,7 @@ pub fn main(args: TokenStream, item: TokenStream) -> TokenStream { let mut rt = tokio::runtime::current_thread::Runtime::new().unwrap(); rt.block_on(async { #body }) } - } + }, }; result.into() |