iroha-internal

Crates.ioiroha-internal
lib.rsiroha-internal
version0.1.1
sourcesrc
created_at2020-06-30 10:32:45.910025
updated_at2020-07-09 09:35:03.845842
descriptionInternal functions, struct for Iroha
homepage
repositoryhttps://github.com/dark-flames/Iroha
max_upload_size
id259777
size29,644
dark-flames (dark-flames)

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