Crates.io | iroha-internal |
lib.rs | iroha-internal |
version | 0.1.1 |
source | src |
created_at | 2020-06-30 10:32:45.910025 |
updated_at | 2020-07-09 09:35:03.845842 |
description | Internal functions, struct for Iroha |
homepage | |
repository | https://github.com/dark-flames/Iroha |
max_upload_size | |
id | 259777 |
size | 29,644 |
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::ToTokens
String
Vec
, HashMap
, HashSet
Result
, Option