Skip to content

Instantly share code, notes, and snippets.

@BobGneu
Created March 21, 2018 17:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BobGneu/0ec9db836023bee988894ec2dc8d2c4d to your computer and use it in GitHub Desktop.
Save BobGneu/0ec9db836023bee988894ec2dc8d2c4d to your computer and use it in GitHub Desktop.
Rust Documentation Article Code Example 2
//! ## Documentation Example
//!
//! This is a lot of great documentation, you ought to read and maintain this.
//!
//! Somehow i think, you are going to not do that.
//!
//! ```rust
//! fn it_works() {
//! assert_eq!(2 + 2, 4);
//! }
//! ```
pub fn meaning_of_life(multiplier: i64) -> i64 {
return 42;
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn it_works() {
assert_eq!(42, meaning_of_life(4));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment