Crates - using local

#1

I am so new to Rust that I can barely spell it, so I am reaching out to the community for a little help. I am writing a sysrc (updates the rc.conf file) type application for NetBSD in Rust. I already have it working in Python, so I have a template to follow. During my “journey” I wanted to check the OS and version number. I added os_type to my Cargo.toml file; however, BSD is not included… yet. I forked the project and started hacking away. Here’s my question, can someone point me to a “how to” on using and test local crates?

  1. Building a crate
  2. Adding the local, newly built crate to my Cargo.toml file

Thank you in advance.

Hand holding is not necessary, but it won’t be rejected either. :grinning:

0 Likes

#2

If it’s a direct dependency, you can specify a path to your fork instead of the version. To override indirect dependencies, see this section:
https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#overriding-dependencies

1 Like

#3

There’s no step 1.

Unlike C, you don’t build dependencies before using them. Cargo wants to be given Rust dependencies in form of Cargo projects with source code, not compiled libraries.

1 Like