Skip to content
This repository was archived by the owner on Oct 30, 2019. It is now read-only.

Commit 0b56d33

Browse files
authored
Fix runtime attrs (#9)
* runtime-tokio 0.3.0-alpha.2 Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com> * Fix attributes import Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
1 parent af30afe commit 0b56d33

File tree

4 files changed

+16
-7
lines changed

4 files changed

+16
-7
lines changed

runtime-attributes/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
Proc Macro attributes for the [Runtime](https://github.com/rustasync/runtime) crate. See the
33
[Runtime](https://docs.rs/runtime) documentation for more details.
44

5+
__This macro was designed to be used from the Runtime crate. Using this in any other way is unlikely
6+
to work.__
7+
58
## Installation
69
With [cargo-edit](https://crates.io/crates/cargo-edit) do:
710
```sh

runtime-attributes/src/lib.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use syn::spanned::Spanned;
2727
#[proc_macro_attribute]
2828
pub fn main(attr: TokenStream, item: TokenStream) -> TokenStream {
2929
let rt = if attr.is_empty() {
30-
syn::parse_str("runtime_native::Native").unwrap()
30+
syn::parse_str("runtime::native::Native").unwrap()
3131
} else {
3232
syn::parse_macro_input!(attr as syn::Expr)
3333
};
@@ -53,7 +53,7 @@ pub fn main(attr: TokenStream, item: TokenStream) -> TokenStream {
5353

5454
let result = quote! {
5555
fn #name() #ret {
56-
runtime_raw::enter(#rt, async { #body })
56+
runtime::raw::enter(#rt, async { #body })
5757
}
5858
};
5959

@@ -75,7 +75,7 @@ pub fn main(attr: TokenStream, item: TokenStream) -> TokenStream {
7575
#[proc_macro_attribute]
7676
pub fn test(attr: TokenStream, item: TokenStream) -> TokenStream {
7777
let rt = if attr.is_empty() {
78-
syn::parse_str("runtime_native::Native").unwrap()
78+
syn::parse_str("runtime::native::Native").unwrap()
7979
} else {
8080
syn::parse_macro_input!(attr as syn::Expr)
8181
};
@@ -95,7 +95,7 @@ pub fn test(attr: TokenStream, item: TokenStream) -> TokenStream {
9595
let result = quote! {
9696
#[test]
9797
fn #name() #ret {
98-
runtime_raw::enter(#rt, async { #body })
98+
runtime::raw::enter(#rt, async { #body })
9999
}
100100
};
101101

@@ -119,7 +119,7 @@ pub fn test(attr: TokenStream, item: TokenStream) -> TokenStream {
119119
#[proc_macro_attribute]
120120
pub fn bench(attr: TokenStream, item: TokenStream) -> TokenStream {
121121
let rt = if attr.is_empty() {
122-
syn::parse_str("runtime_native::Native").unwrap()
122+
syn::parse_str("runtime::native::Native").unwrap()
123123
} else {
124124
syn::parse_macro_input!(attr as syn::Expr)
125125
};
@@ -147,7 +147,7 @@ pub fn bench(attr: TokenStream, item: TokenStream) -> TokenStream {
147147
#[bench]
148148
fn #name(b: &mut test::Bencher) {
149149
b.iter(|| {
150-
let _ = runtime_raw::enter(#rt, async { #body });
150+
let _ = runtime::raw::enter(#rt, async { #body });
151151
});
152152
}
153153
};

runtime-tokio/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "runtime-tokio"
33
description = "A Tokio-based asynchronous runtime"
4-
version = "0.3.0-alpha.1"
4+
version = "0.3.0-alpha.2"
55
license = "MIT OR Apache-2.0"
66
readme = "README.md"
77
repository = "https://github.com/rustasync/runtime"

src/lib.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,3 +106,9 @@ pub use runtime_attributes::{bench, test};
106106
#[doc(inline)]
107107
#[cfg(not(test))] // NOTE: exporting main breaks tests, we should file an issue.
108108
pub use runtime_attributes::main;
109+
110+
#[doc(hidden)]
111+
pub use runtime_raw as raw;
112+
113+
#[doc(hidden)]
114+
pub use runtime_native as native;

0 commit comments

Comments
 (0)