ink! Analyzer Proc-macros

Procedural macros for ink-analyzer and ink-analyzer-ir.

This library implements procedural macros (e.g. custom derive macros for ink! IR traits) used primarily by the ir crate.

Installation

Run the following Cargo command in your project directory

shell cargo add ink-analyzer-macro

Usage

Example:

Using custom derive macros for the FromInkAttribute and FromSyntax traits to create a Contract IR type.

```rust use inkanalyzermacro::{FromInkAttribute, FromSyntax}; use inkanalyzerir::{Event, FromInkAttribute, FromSyntax, InkAttrData, InkAttribute, Message}; use inkanalyzerir::ast::Module;

[derive(FromInkAttribute, FromSyntax)]

struct Contract { #[macrokind(Contract)] inkattr: InkAttrData, #[argkind(Event)] events: Vec, #[argkind(Message)] messages: Vec, // --snip-- } ```

Documentation

https://docs.rs/ink-analyzer-macro/latest/inkanalyzermacro/

Or you can access documentation locally by running the following command from the project root

shell cargo doc -p ink-analyzer-macro --open

Testing

You can run unit tests for all the core functionality by running the following command from the project root

shell cargo test -p ink-analyzer-macro

License

This code is released under both MIT and Apache-2.0 licenses.