mirror of
https://github.com/darkicewolf50/RustBrock.git
synced 2025-06-15 13:04:18 -06:00
69 lines
2.8 KiB
Markdown
69 lines
2.8 KiB
Markdown
Not happy with this
|
|
|
|
Rust is a very unique language and a great guiding book.
|
|
You can learn more [here](https://doc.rust-lang.org/book/ch14-02-publishing-to-crates-io.html) about Rust's Documentation for publishing packages.
|
|
|
|
The goal of this is to passively train you how to produce comments and code worthy of being open source and industry level.
|
|
|
|
Due to the language's interesting module seperating when creating a large program. All members will be involved in the creation of all functions and how they should be seperated into their groups of related ideas.
|
|
|
|
First off the file tree structure will look like this example
|
|
```
|
|
src/
|
|
├── lib.rs
|
|
├── front_of_house.rs
|
|
└── front_of_house/
|
|
├── a_different_mod.rs
|
|
└── other_module_linked_in_modrs.rs
|
|
```
|
|
These are all related functions in front of house, for small modules do not make a sub directory only large or major functions should be seperated
|
|
|
|
Where *`front_of_house.rs`* is like this
|
|
```rust
|
|
//! Describes what front_of_house module provides
|
|
//! All functionality in other files this serves as a connector
|
|
//! Main idea and a run should be in this file
|
|
//! re exports go here as well
|
|
pub mod a_different_mod;
|
|
// only split if a different losely related idea is needed (the sub idea more relates to itself than to the parent)
|
|
pub mod other_module_linked_in_modrs;
|
|
```
|
|
|
|
Also where *`other_module_linked_in_modrs.rs`* looks like this
|
|
```rust
|
|
/// What the function does
|
|
///
|
|
/// ### Params
|
|
///
|
|
/// - input_var - Description of what the input should be.
|
|
/// - b - Description of the second input parameter.
|
|
///
|
|
/// ### Returns
|
|
///
|
|
/// - Description of the return value.
|
|
///
|
|
/// ### Example Usage
|
|
///
|
|
/// ```rust
|
|
/// // how a user would use this function, replace ex_crate with actual path to use function
|
|
/// // this is how a public but internal module would be used by an outside user (ex_crate needs to be changed)
|
|
/// let result = crate::front_of_house::other_module_linked_in_modrs::example_funct(5, 10);
|
|
/// assert_eq!(result, 15);
|
|
/// ```
|
|
/// ### Author (s)
|
|
///
|
|
/// - Name <semiperminant@exmaplemail.com>
|
|
/// - Another Example <different@examplemail.com>
|
|
/// semi-permanent email, do not need to respond but try to be a good alumni
|
|
pub fn example_funct(input_var: i32, b: i32) -> i32 {
|
|
// example variable can be anything not just an integer
|
|
let var_example = 0;
|
|
|
|
// example function does nothing significant
|
|
var_example + input_var + b
|
|
}
|
|
```
|
|
|
|
One all of the main modules have been decided upon a senior member or lead will be assigned to that module will then be responsible and will break the module into sub components to assign out to implement.
|
|
|
|
The team will then come other for a final time to ensure that all sub modules make sense and thier ideas make sense and are appropriately assigned out. |