< 返回我的博客

rdigua 发表于 2020-07-10 21:23

Tags:rust

Cargo

main.rs lib.rs other.rs another.rs

-lib.rs

pub mod other;
pub mod another; 

-main.rs

// Cargo.toml name="xxx"
use xxx::{...*...};

other.rs

//if use another.rs
use super::another...

about test

/test/test.rs

use xxx::...

The lib.rs and main.rs files are two independent entry points for your package.

more

Read more: Clear explanation of Rust’s module system

评论区

写评论
Freddie Mercury 2020-07-11 06:43

言简意赅,茅塞顿开

1 共 1 条评论, 1 页