Cargo.toml path [lib] cannot specify a folder?

Here is my Cargo.toml profile

[package]
name = "rustlibrary"
version = "0.2.0"
authors = [
    "James Zow <jameszow@163.com>"
]
license = "Apache-2.0"
repository = "https://github.com/Jzow/rustlibrary"
#documentation = "https://docs.rs/rustlibrary"
readme = "README.md"
description = "Integrate all rust related projects and books for easy reading"
edition = "2021"

[workspace]
members = [
    # other module
    "leetcode",
    "microsoft",
    # basics workspace
    "basics/attributes",
    "basics/conversion",
    "basics/crates",
    "basics/customtypes",
    "basics/expressions",
    "basics/flowofcontrol",
    "basics/formatprint",
    "basics/function",
    "basics/modules",
    "basics/primitives",
    "basics/types",
    "basics/utiltest",
    "basics/varbindings",
    # complex workspace
    "complex/closure",
    "complex/concurrent",
    "complex/generics",
    "complex/ownership",
    "complex/smartpointer",
    # example workspace
    "example/guessgame",
    "example/httpie",
    "example/journal",
    "example/queryer",
    "example/restaurant",
    "example/thumbor",
    "example/minigrep",
    # web workspace
    "web/webapp",
    "web/webservice",
    "web/cindy",
]

[lib]
# https://bheisler.github.io/criterion.rs/book/faq.html#cargo-bench-gives-unrecognized-option-errors-for-valid-command-line-options
name = "rustlibrary"
path = "basics/crates"
bench = false

error message:

➜  rustlibrary git:(dev) ✗ cargo build
   Compiling rustlibrary v0.2.0 (/Users/jameszow/Documents/RustWorkSpace/rustlibrary)
error: couldn't read basics/crates: Is a directory (os error 21)

error: could not compile `rustlibrary` due to previous error

He can only specify ib.rs I want to build these sub modules

It's not clear what this would mean, a Rust crate is, in an API sense, a wrapper for a Rust module, and a directory isn't a module.

What does someone importing this lib see?

You might just want:

// ./Cargo.toml
...
[dependencies]
basics_crates.path = "basics/crates"
// ./src/lib.rs
pub use basics_crates::*;

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.