template_rust/lib.rs
1//! A template Rust library crate.
2//!
3//! **[Crates.io](https://crates.io/crates/template-rust) │ [Repo](https://github.com/alecmocatta/template-rust)**
4//!
5//! This is template for Rust libraries, comprising a [`hello_world()`] function.
6//!
7//! # Example
8//!
9//! ```
10//! use template_rust::hello_world;
11//!
12//! hello_world();
13//! // prints: Hello, world!
14//! ```
15//!
16//! # Note
17//!
18//! Caveat emptor.
19
20#![doc(html_root_url = "https://docs.rs/template-rust/0.1.0")]
21#![warn(
22 missing_copy_implementations,
23 missing_debug_implementations,
24 missing_docs,
25 trivial_casts,
26 trivial_numeric_casts,
27 unused_import_braces,
28 unused_qualifications,
29 unused_results,
30 clippy::pedantic
31)] // from https://github.com/rust-unofficial/patterns/blob/master/anti_patterns/deny-warnings.md
32#![allow()]
33
34/// Print "Hello, world!".
35///
36/// # Example
37///
38/// ```
39/// use template_rust::hello_world;
40///
41/// hello_world();
42/// // prints: Hello, world!
43/// ```
44///
45/// # Panics
46///
47/// Will panic if printing fails.
48pub fn hello_world() {
49 print!("Hello, world!");
50}
51
52#[cfg(test)]
53mod tests {
54 use super::hello_world;
55
56 #[test]
57 fn succeeds() {
58 hello_world();
59 }
60}