2 releases
0.1.1 | Jun 20, 2023 |
---|---|
0.1.0 | Jun 20, 2023 |
#127 in #performing
5KB
Crate Name
crate_name
is a Rust crate that provides utility functions and enums for performing various operations.
Usage
Add the following line to your Cargo.toml
file:
[dependencies]
crate_name = "0.1.0"
Examples
use crate_name::add;
use crate_name::utils::Color;
fn main() {
let result = add(2, 2);
println!("Addition result: {}", result);
let color = Color::Red;
println!("Selected color: {:?}", color);
}
Functions
The crate provides the following functions:
add
Adds two numbers together and returns the result.
Arguments
left
: The first number to be added.right
: The second number to be added.
Returns
The sum of the two input numbers.
Examples
use crate_name::add;
let result = add(2, 3);
assert_eq!(result, 5);
Enums
The crate provides the following enum:
Color
An enum representing different colors.
Variants
Red
: The color red.Green
: The color green.Blue
: The color blue.
Examples
use crate_name::utils::Color;
let color = Color::Red;
println!("Selected color: {:?}", color);
Testing
The crate includes unit tests for the add
function. You can run the tests using the following command:
cargo test
The tests ensure that the add
function correctly adds two numbers together.
License
This crate is distributed under the terms of the MIT license. See the LICENSE file for details.