I am trying to write a Rust library with this layout:
.
├── Cargo.lock
├── Cargo.toml
├── examples
│ └── main.rs
├── src
│ ├── client.rs
│ └── lib.rs
└── target
└── rls
└── debug
├── build
├── deps
client.rs
has all the code and the client struct is public
lib.rs
contains pub mod client;
examples/main.rs:
extern crate fistrs;
use fistrs::client::FistClient;
fn main() {
let mut client = FistClient::new("localhost", "5575");
client.connect();
}
but I get an error when I run this rustc examples/main.rs
--> examples/main.rs:1:1
|
1 | extern crate fistrs;
| ^^^^^^^^^^^^^^^^^^^^ can't find crate
Here is my Cargo.toml
[package]
name = "fistrs"
version = "0.1.0"
authors = ["palash25 <npalash25@gmail.com>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]