Skip to content

A tokenization library for Rust

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

dark-flames/Iroha

Repository files navigation

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

About

A tokenization library for Rust

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages