Crates.io | iroha |
lib.rs | iroha |
version | 0.1.7 |
source | src |
created_at | 2020-06-30 10:35:59.344522 |
updated_at | 2021-01-27 18:07:10.4163 |
description | A tokenization Library for Rust |
homepage | |
repository | https://github.com/dark-flames/Iroha |
max_upload_size | |
id | 259779 |
size | 19,257 |
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)]
#[Iroha(mod_path="path::to::mod")]
enum Bar {
A(u8, String),
B
}
fn some_fn() -> TokenStream {
let foo = Foo {a: 1, b: 2};
let bar = Bar::A(1, "test".to_string);
quote! {
|| (#foo, #bar)
}
}
quote::ToTokens
String
Vec
, HashMap
, HashSet
Result
, Option
Tuple
(only support two elements)std::marker::PhantomData