Skip to content

Commit

Permalink
docs(gmeta): add documentation for gmeta crate (#2761)
Browse files Browse the repository at this point in the history
  • Loading branch information
shamilsan authored Jul 12, 2023
1 parent 5bb6012 commit df995d2
Show file tree
Hide file tree
Showing 5 changed files with 343 additions and 9 deletions.
3 changes: 3 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions gmeta/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,10 @@ hex = { workspace = true, features = ["alloc"] }
gmeta-codegen = { path = "codegen", optional = true }
derive_more.workspace = true

[dev-dependencies]
gear-wasm-builder.workspace = true
gstd.workspace = true
parity-scale-codec.workspace = true

[features]
codegen = ["gmeta-codegen"]
21 changes: 20 additions & 1 deletion gmeta/codegen/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
// This file is part of Gear.

// Copyright (C) 2022-2023 Gear Technologies Inc.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0

// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

use proc_macro::TokenStream;
use quote::{quote, ToTokens};
use std::{borrow::Borrow, fmt::Display, iter};
Expand Down Expand Up @@ -55,6 +73,7 @@ fn validate_if_has_no_attributes(
/// Generates metawasm functions.
///
/// An example of the expected structure:
///
/// ```
/// use gstd::prelude::*;
///
Expand Down Expand Up @@ -101,7 +120,7 @@ fn validate_if_has_no_attributes(
/// `State` identifier. The type for which `State` will be an alias **must**
/// implement [`Decode`] trait.
///
/// Usually the state type should be imported from the implemented associative
/// Usually the state type should be imported from the implemented associated
/// [`Metadata::State`](../gmeta/trait.Metadata.html#associatedtype.State) type
/// from the contract's `io` crate.
///
Expand Down
Loading

0 comments on commit df995d2

Please sign in to comment.