leomeinel_sample/lib.rs
1/*
2 * leomeinel_sample is a cargo crate.
3 * Copyright © 2022 Leopold Meinel & contributors
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see https://github.com/LeoMeinel/leomeinel_sample/blob/main/LICENSE
17 */
18
19//! # leomeinel_sample
20//!
21//! `leomeinel_sample` is a collection of utilities to perform checks on numbers
22
23pub use self::utilities::is_dividable_by_two;
24pub use self::utilities::is_three;
25
26pub mod utilities {
27 /// Returns true if input is equal to 3
28 ///
29 /// # Examples
30 ///
31 /// ```
32 /// let arg = 3;
33 /// let arg_is_three = leomeinel_sample::is_three(arg);
34 /// assert_eq!(true, arg_is_three);
35 /// ```
36 pub fn is_three(x: i128) -> bool {
37 x == 3
38 }
39
40 /// Returns true if input is dividable by 2
41 ///
42 /// # Examples
43 ///
44 /// ```
45 /// let arg = 4;
46 /// let arg_is_dividable_by_two = leomeinel_sample::is_dividable_by_two(arg);
47 /// assert_eq!(true, arg_is_dividable_by_two);
48 /// ```
49 pub fn is_dividable_by_two(x: i128) -> bool {
50 x % 2 == 0
51 }
52}