s0lari_create 0.1.1

A simple library for learning
Documentation
//! # My Crate
//!
//! `my_crate` is a collection of utilities to make performing certain
//! calculations more convinient
//! 
//! # Utils
//! 
//! `utils` is a collection of utils that helps to perform

/// Adds one to the number given.
///
/// # Examples
/// 
/// ``````
/// let arg = 5;
/// let answer = my_crate::add_one(arg);
/// 
/// assert_eq!(6, answer);
/// ```

pub fn add_one(x: i32) -> i32 {
    x + 1
}

/// Squares the given number
/// 
/// # Example
/// 
/// ```
/// let number = 5;
/// let result = square(number);
/// 
/// assert_eq!(25, result);
/// ```

pub fn square(n: i32) -> i32 {
    n * n
}

/// Calculate the length of the given string
/// 
/// # Example
/// 
/// ```
/// let string = String::from("Hello world!");
/// let length = calculate_length(&string);
/// 
/// assert_eq!(12, length);
/// ```
pub fn calculate_length(string: &String) -> usize {
    string.len()
}