1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
//! # I will explain what are the things this crate contains
//!
//! some function for basic arithmetic operations
pub mod arith_container{
/// Increments the given value by 1.
///
/// # Example
///
/// * `arg` any i32 instance
///
/// ```
/// let arg = 5;
/// let answer = my_crate::increment(arg);
///
/// assert_eq!(6, answer);
/// ```
pub fn increment(x: i32) -> i32{
x + 1
}
/// Decrement the given value by 1.
///
/// # Example
///
/// ```
/// let arg = 5;
/// let answer = my_crate::decrement(arg);
///
/// assert_eq!(4, answer);
/// ```
pub fn decrement(x: i32) -> i32{
x - 1
}
/// Returns Square value of the given number.
///
/// # Example
/// ```
/// let arg = 5;
/// let ans = my_crate::square(arg);
///
/// asswert_eq!(25, ans);
/// ```
pub fn square(x: i32) -> i32{
x * x
}
/// Returns double the value of given number.
///
/// # Example
/// ```
/// let arg = 5;
/// let ans = my_crate::double(arg);
///
/// asswert_eq!(10, ans);
/// ```
pub fn double(x: i32) -> i32{
x * 2
}
/// Returns half of the given number.
///
/// # Example
/// ```
/// let arg = 5;
/// let ans = my_crate::square(arg);
///
/// asswert_eq!(25, ans);
/// ```
pub fn half(x: i32) -> f32{
x as f32 / 2 as f32
}
}