new_project_2/
lib.rs

1   // -------------------------------------------
2   // 			Publishing your Crate
3   // -------------------------------------------
4
5   /* 
6   These lines are not going to be part of documentation 
7   */ 
8
9   // These comments will not be available in the documentation 
10
11
12   //! # Basic math crate 
13   //! This is a collection of some generally used math functions 
14   //! 
15   /// Computes a square of an input number
16   /// 
17   /// # Examples
18   /// # Tests
19   /// ```
20   /// let n = 5;
21   /// let answer = new_project::square(n);
22   /// assert_eq!(25,answer);
23   /// ```
24   /// # limitations
25   /// 
26   /// # Some other section
27   pub fn square(num:i32) -> i32 {
28    num * num
29}
30
31
32/// Computes a cube of an input number
33/// 
34/// # Examples
35/// # Tests
36/// ```
37/// let n = 5;
38/// let answer = new_project::cube(n);
39/// assert_eq!(125,answer);
40/// ```
41/// # limitations
42/// 
43/// # Some other section
44pub fn cube(num:i32) -> i32 {
45 num * num * num
46}