Skip to content
This repository was archived by the owner on Oct 17, 2023. It is now read-only.

docs on local dependency #165

Merged
merged 1 commit into from
May 23, 2023
Merged
Show file tree
Hide file tree
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
26 changes: 25 additions & 1 deletion docs/modules_packages_crates/dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,37 @@ For example, to add the [ecrecover-noir library](https://github.com/colinnielsen
ecrecover = {tag = "v0.2.0", git = "https://github.com/colinnielsen/ecrecover-noir"}
```

## Specifying a local dependency
You can also specify dependencies that are local to your machine.

For example, this file structure has a library and binary crate
```
├── binary_crate
│   ├── Nargo.toml
│   └── src
│   └── main.nr
└── liba
├── Nargo.toml
└── src
└── lib.nr
```

Inside of the binary crate, you can specify:
```toml
# Nargo.toml

[dependencies]
libA = { path = "../liba" }
```

## Importing dependencies

You can import a dependency to a Noir file using the following syntax. For example, to import the
ecrecover-noir library referenced above:
ecrecover-noir library and local liba referenced above:

```rust
use dep::ecrecover;
use dep::libA;
```

You can also import only the specific parts of dependency that you want to use. For example,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,37 @@ For example, to add the [ecrecover-noir library](https://github.com/colinnielsen
ecrecover = {tag = "v0.2.0", git = "https://github.com/colinnielsen/ecrecover-noir"}
```

## Specifying a local dependency
You can also specify dependencies that are local to your machine.

For example, this file structure has a library and binary crate
```
├── binary_crate
│   ├── Nargo.toml
│   └── src
│   └── main.nr
└── liba
├── Nargo.toml
└── src
└── lib.nr
```

Inside of the binary crate, you can specify:
```toml
# Nargo.toml

[dependencies]
libA = { path = "../liba" }
```

## Importing dependencies

You can import a dependency to a Noir file using the following syntax. For example, to import the
ecrecover-noir library referenced above:
ecrecover-noir library and local liba referenced above:

```rust
use dep::ecrecover;
use dep::libA;
```

You can also import only the specific parts of dependency that you want to use. For example,
Expand Down