Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions docs/develop/contracts/rust/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,26 +142,24 @@ contract using `cargo`. To create the repository, navigate back to your projects
the following commands:

```bash
$ cargo new rust-counter-tutorial
$ cargo new rust-counter-tutorial --lib
$ cd rust-counter-tutorial
```

The first command creates a new directory called `rust-counter-tutorial`. We’ve named the project
`rust-counter-tutorial`, and Cargo creates its files in a directory of the same name.

If you check the `rust-counter-tutorial` directory, you’ll see that Cargo has generated two
files and one directory for us: a `Cargo.toml` file and a `src` directory with a `main.rs` file
files and one directory for us: a `Cargo.toml` file and a `src` directory with a `lib.rs` file
inside.

```bash
.
├── Cargo.toml
└── src
└── main.rs
└── lib.rs
```

> **Note:** The `main.rs` is not needed for this example, so feel free to delete it.

## Creating the files {#creating-the-files}

This smart contract project starts out with a simple layout:
Expand Down Expand Up @@ -215,9 +213,9 @@ overflow-checks = true

</details>

### Creating `lib.rs` {#creating-librs}
### Editing `lib.rs` {#editing-librs}

Create a `./src/lib.rs` file in your text editor, and paste the content of the following
Open the `./src/lib.rs` file in your text editor, and paste the content of the following
[`lib.rs`](https://github.com/near-examples/rust-counter/blob/master/contract/src/lib.rs) file.
This example uses a `lib.rs` file with the smart contract logic using a `struct`,
the `struct`'s functions, and unit tests. This will all be in one file for this simple example.
Expand Down