iroha-derive

Crates.ioiroha-derive
lib.rsiroha-derive
version0.1.2
sourcesrc
created_at2020-06-30 10:33:51.21398
updated_at2020-07-09 09:37:32.870067
descriptionInternal derive for Iroha
homepage
repositoryhttps://github.com/dark-flames/Iroha
max_upload_size
id259778
size27,373
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)]
enum Bar {
    A,
    B
}

fn some_fn() -> TokenStream {
    let foo = Foo {a: 1, b: 2};
    let bar = Bar::A;

    quote! {
        || (#foo, #bar)
    }
}

Supported Type

  • Any types witch implemented quote::ToTokens
  • String
  • Vec, HashMap, HashSet
  • Result, Option
Commit count: 40

cargo fmt