iroha

Crates.ioiroha
lib.rsiroha
version0.1.7
sourcesrc
created_at2020-06-30 10:35:59.344522
updated_at2021-01-27 18:07:10.4163
descriptionA tokenization Library for Rust
homepage
repositoryhttps://github.com/dark-flames/Iroha
max_upload_size
id259779
size19,257
Marin Veršić (mversic)

documentation

README

Iroha

Iroha is a tokenization Library for Rust.

Usage

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)
    }
}

Supported Type

  • Any types witch implemented quote::ToTokens
  • String
  • Vec, HashMap, HashSet
  • Result, Option
  • Tuple(only support two elements)
  • std::marker::PhantomData
Commit count: 40

cargo fmt