Rust allows crates to expose usage demonstrations by adding an examples/ directory at the root of the project.
This could be a great way to show how to use the library and make it easier for users to get started.
For example, the project structure could look like this:
.
├── Cargo.lock
├── Cargo.toml
├── examples
│ └── ... #here we can add main examples
└── src
├── functions
│ ├── cosine.rs
│ ├── cross_product.rs
│ ├── linear_combination.rs
│ ├── linear_interpolation.rs
│ └── mod.rs
├── lib.rs
├── macros
│ ├── arithmetics.rs
│ └── mod.rs
├── matrix
│ ├── arithmetics.rs
│ └── functions
│ ├── determinant.rs
│ ├── inverse.rs
│ ├── mod.rs
│ ├── rank.rs
│ ├── row_echelon.rs
│ ├── trace.rs
│ └── transpose.rs
├── matrix.rs
├── rows.rs
├── vector
│ ├── arithmetics.rs
│ └── functions
│ ├── dot_product.rs
│ ├── mod.rs
│ └── norm.rs
└── vector.rs
Each file in the examples/ directory could demonstrate a concrete use case (vector operations, matrix functions, etc.) and can be run with:
cargo run --example example_name
I think this would greatly improve the usability and documentation of the crate.
Let me know what you think!