How to share common code between Cargo project examples?

Viewed 143

What is the common way to share code between multiple examples defined as part of a Cargo project?

This is my library project:

.
├── Cargo.toml
├── src/
│   └── lib.rs
├── examples/
│   └── example-A/
│   │    └── main.rs
│   └── example-B/
│       └── main.rs

I need to share some code only between example-A and example-B. Where should the shared code live, and how can I refer to it from these two examples?

0 Answers
Related