ink-analyzer/crates/macro
davidsemakula 9d0122863b bump crate versions:
- analyzer -> 0.8.22
- lsp-server -> 0.2.24
- ir -> 0.12.1
- macro -> 0.7.2
2024-02-04 18:33:34 +03:00
..
src style updates 2024-01-06 15:56:42 +03:00
Cargo.toml bump crate versions: 2024-02-04 18:33:34 +03:00
README.md update docs 2023-12-09 11:45:20 +03:00

ink! Analyzer Proc-macros

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

This library implements procedural macros used primarily by the ink-analyzer-ir crate.

Installation

Run the following Cargo command in your project directory

cargo add ink-analyzer-macro

Usage

Example:

Using ink_analyzer_macro::entity proc-macro to create a Contract type.

use ink_analyzer_ir::{Event, Message, Storage};
use ink_analyzer_ir::ast;

#[ink_analyzer_macro::entity(macro_kind = Contract)]
#[derive(Debug, Clone, PartialEq, Eq)]
struct Contract {
    ast: ast::Module,
    storage: Option<Storage>,
    events: Vec<Event>,
    #[initializer(call = ink_analyzer_ir::ink_callable_closest_descendants)]
    messages: Vec<Message>,
    // --snip--
}

Documentation

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

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

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

cargo test -p ink-analyzer-macro

License

Licensed under either MIT or Apache-2.0 license at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.