9 releases
0.1.25 | Nov 12, 2021 |
---|---|
0.1.1 | Nov 7, 2021 |
0.0.85 | Nov 7, 2021 |
0.0.1 | Oct 31, 2021 |
#514 in #time
20KB
438 lines
Provides hundreds of useful functions for manipulating strings, files, numbers, value conversion, etc.
Examples
Example 1 (Module conversions
)
Cargo.toml File:
[package]
name = "project_name"
version = "0.0.1"
edition = "2021"
[dependencies]
general_tools = "latest version"
src\main.rs File:
use general_tools::conversions::temperature::Temperature;
fn main() {
let celsius: Temperature = Temperature{
temperature_type: String::from("Celsius"),
value: 10.0
};
// or:
/*
let mut celsius: Temperature = Temperature::new();
celsius.temperature_type = String::from("Celsius");
celsius.value = 10.0;
*/
let fahrenheit: f64 = celsius.to_fahrenheit();
println!("{} °C = {} °F", celsius.value, fahrenheit);
}
Output:
10.0 °C = 50.0 °F
Example 2 (Module file
):
Cargo.toml File:
[package]
name = "project_name"
version = "0.0.1"
edition = "2021"
[dependencies]
general_tools = "latest version"
src\main.rs File:
use general_tools::file::File;
fn main() {
let mut file: File = File::new();
}
Output:
Example 3 (Module math
):
Cargo.toml File:
[package]
name = "project_name"
version = "0.0.1"
edition = "2021"
[dependencies]
general_tools = "latest version"
src\main.rs File:
Output:
Example 4 (Module string
):
[package]
name = "project_name"
version = "0.0.1"
edition = "2021"
[dependencies]
general_tools = "latest version"
src\main.rs File:
Output:
Example 5 (Module time
):
[package]
name = "project_name"
version = "0.0.1"
edition = "2021"
[dependencies]
general_tools = "latest version"
src\main.rs File:
Output:
Dependencies
~22KB