Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Here is my directory structure:

lowks@lowkster ~/src/rustlang/gettingrusty $ tree .
.
├── Cargo.lock
├── Cargo.toml
├── foo.txt
├── src
│?? ├── boolean_example.rs
│?? ├── function_goodbye_world.rs
│?? ├── listdir.rs
│?? ├── looping.rs
│?? ├── main.rs
│?? ├── pattern_match.rs
│?? └── write_to_file.rs
└── target
    ├── build
    ├── deps
    ├── examples
    ├── gettingrusty
    └── native

6 directories, 11 files

When I run 'cargo build', it seems to only build main.rs. How should I change Cargo.toml to build the rest of the files too?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
1.2k views
Welcome To Ask or Share your Answers For Others

1 Answer

Put other.rs file into bin subfolder of src folder (./src/bin/other.rs). And run cargo build --bin other or cargo run --bin other


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...