Skip to content

Commit

Permalink
feat: link to rust doc in documentation (NethermindEth#139)
Browse files Browse the repository at this point in the history
  • Loading branch information
julio4 authored Dec 5, 2023
1 parent 3dee11a commit d8bdbed
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/ch00/basics/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ It's important to take the time to document your code. It will helps developers

In Cairo, you can add comments with `//`.

### Best Practices:

Since Cairo 1, the community has adopted a [Rust-like documentation style](https://doc.rust-lang.org/rust-by-example/meta/doc.html).

### Contract Interface:

In smart contracts, you will often have a trait that defines the contract's interface (with `#[starknet::interface]`).
Expand All @@ -15,10 +19,12 @@ trait IContract<TContractState> {
/// High-level description of the function
///
/// # Arguments
///
/// * `arg_1` - Description of the argument
/// * `arg_n` - ...
///
/// # Returns
///
/// High-level description of the return value
fn do_something(ref self: TContractState, arg_1: T_arg_1) -> T_return;
}
Expand Down

0 comments on commit d8bdbed

Please sign in to comment.