This repository has been archived on 2018-10-12. You can view files and clone it, but cannot push or open issues or pull requests.
literate-tribble/adder/src/lib.rs

30 lines
446 B
Rust

//! The `adder` crate provides functions that add numbers to other numbers
//!
//! # Examples
//!
//! ```
//! assert_eq!(4, adder::add_two(2));
//! ```
/// This function adds two to its argument
///
/// # Examples
///
/// ```
/// use adder::add_two;
///
/// assert_eq!(4, add_two(2));
/// ```
pub fn add_two(a: i32) -> i32 {
a + 2 // return
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn it_works() {
assert_eq!(4, add_two(2));
}
}