publishing/
lib.rs

1/*
2 * Theses lines are not going to be part of the code
3 */
4
5//! # Basic math Crate
6//! Collection of some generally used math function
7/// A function that returns the square of a number
8///
9/// # Examples
10/// # Tests
11/// ```
12/// let n = 5;
13/// let answer = publishing::square(n);
14/// assert_eq!(answer, 25);
15/// ```
16///
17/// # Limitations
18///
19/// # Some other section
20///
21///
22/// # Examples
23///
24/// ```
25/// use publishing::square;
26///
27/// assert_eq!(square(5), 25);
28/// ```
29pub fn square(num: i32) -> i32 {
30    num * num
31}
32
33/// A function that returns the cube of a number
34///
35/// # Examples
36/// # Tests
37/// ```
38/// let n = 5;
39/// let answer = publishing::cube(n);
40/// assert_eq!(answer, 125);
41/// ```
42///
43/// # Limitations
44///
45/// # Some other section
46///
47/// # Examples
48///
49/// ```
50/// use publishing::cube;
51///
52/// assert_eq!(cube(5), 125);
53/// ```
54pub fn cube(num: i32) -> i32 {
55    num * num * num
56}