豆豆友情提示:这是一个非官方 GitHub 代理镜像,主要用于网络测试或访问加速。请勿在此进行登录、注册或处理任何敏感信息。进行这些操作请务必访问官方网站 github.com。 Raw 内容也通过此代理提供。
Skip to content

Latest commit

 

History

History
51 lines (36 loc) · 866 Bytes

File metadata and controls

51 lines (36 loc) · 866 Bytes

The Algorithms: Rust

This project aims at showcasing common algorithms implemented in Rust, with an accent on idiomatic code and genericity.

Project structure

The project is organized as follows:

src/

  • my_algo_category/
    • mod.rs
    • my_algorithm.rs
    • some_other_algorithm.rs
  • some_other_algo_category/
    • ...

mod.rs contains the export:

mod my_algorithm;

pub use self::my_algorithm::my_algorithm;

my_algorithm.rs contains your algorithm and the related tests:

pub fn my_algorithm() {
    // ...
}

#[cfg(test)]
mod tests {
    #[test]
    fn my_test() {
        // ...
    }
}

Before submitting your PR

Do not use acronyms: DFS should be depth_first_search.

Make sure you run

  • cargo test
  • cargo fmt
  • cargo clippy --all -- -D warnings

And that's about it !