| Crates.io | iroha-derive |
| lib.rs | iroha-derive |
| version | 0.1.2 |
| created_at | 2020-06-30 10:33:51.21398+00 |
| updated_at | 2020-07-09 09:37:32.870067+00 |
| description | Internal derive for Iroha |
| homepage | |
| repository | https://github.com/dark-flames/Iroha |
| max_upload_size | |
| id | 259778 |
| size | 27,373 |
Iroha is a tokenization Library for Rust.
Iroha provide derive macro iroha::ToTokens.
Derived struct or enum will be implemented quote::ToTokens.
use iroha::ToTokens;
use proc_macro2::TokenStream;
use quote::quote;
#[derive(ToTokens)]
struct Foo {
a: i32,
b: i64
}
#[derive(ToTokens)]
enum Bar {
A,
B
}
fn some_fn() -> TokenStream {
let foo = Foo {a: 1, b: 2};
let bar = Bar::A;
quote! {
|| (#foo, #bar)
}
}
quote::ToTokensStringVec, HashMap, HashSetResult, Option