Depend on Local Package

  Kiến thức lập trình

How do you reference a local package in rust?

I added a local dep to Cargo:

xl = { path = "../xl" }

And tried to use it in lib.rs:

extern crate xl;

#[pyclass]
struct PrivateRustObject {
    wb: Box<xl::Workbook>,
}

But got the error:

error[E0463]: can't find crate for `xl`
 --> src/lib.rs:2:1
  |
2 | extern crate xl;
  | ^^^^^^^^^^^^^^^^ can't find crate

I tried adding and removing extern crate xl; but got missing package errors in both cases. I verified that the package is at that directory and has that name. When I run “maturin develop”, the “xl” package compiles, so Rust is finding it.

LEAVE A COMMENT