deranson / climbing

Learning rust language is tough for me, so record practice here.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Climbing

License: MIT

Learning rust language is tough for me, so record practice here.

Structure

 climbing/
 ┣ docs
 ┃ ┗ strings.md
 ┃ ┗ foo.md
 ┃ ┗ ...
 ┃
 ┣ src
 ┃ ┗ modules
 ┃   ┗ strings.rs
 ┃   ┗ foo.rs
 ┃   ┗ ...
 ┃
 ┃ ┗ modules.rs
 ┃ ┗ main.rs
main.rs
mod modules;

use modules::strings::qstring;

fn main() {
   let quote = qstring("Learning rust language is tough for me, so record practice here");

   println!("{}", quote);
}
...
modules.rs
pub mod strings;

...
modules/strings.rs
/// Create String from &str directly

pub fn qstring(str: &str) -> String {
    String::from(str)
}

...

Usage

  • Install rust in your local follow this guide (Note: this repository uses the rust package manager Cargo)
  • Clone this repository to your local
  • Reference and use modules in main.rs
  • Cd the root dir
  • Run cargo run command

Docs

For example, docs/foo.md is the note of the code src/modules/foo.rs of the content Foo in Rust lang.

Contents & Docs & Modules

Contents Docs Modules
String strings.md strings.rs
Variables and Mutability variables_mutability.md variables_mutability.rs

License

MIT

About

Learning rust language is tough for me, so record practice here.

License:MIT License


Languages

Language:Rust 100.0%