2021-02-21 14:25:12 +01:00
|
|
|
//! The point of this crate is to be able to have enough different "kinds" of
|
|
|
|
|
//! documentation generated so we can test each different features.
|
|
|
|
|
|
|
|
|
|
#![crate_name = "test_docs"]
|
2021-05-21 22:53:50 +02:00
|
|
|
#![feature(doc_keyword)]
|
2021-06-24 14:30:01 +02:00
|
|
|
#![feature(doc_cfg)]
|
2021-02-21 14:25:12 +01:00
|
|
|
|
|
|
|
|
use std::fmt;
|
|
|
|
|
|
|
|
|
|
/// Basic function with some code examples:
|
|
|
|
|
///
|
|
|
|
|
/// ```
|
|
|
|
|
/// println!("nothing fancy");
|
|
|
|
|
/// ```
|
|
|
|
|
///
|
|
|
|
|
/// A failing to compile one:
|
|
|
|
|
///
|
|
|
|
|
/// ```compile_fail
|
|
|
|
|
/// println!("where did my argument {} go? :'(");
|
|
|
|
|
/// ```
|
|
|
|
|
///
|
|
|
|
|
/// An ignored one:
|
|
|
|
|
///
|
|
|
|
|
/// ```ignore (it's a test)
|
|
|
|
|
/// Let's say I'm just some text will ya?
|
|
|
|
|
/// ```
|
|
|
|
|
pub fn foo() {}
|
|
|
|
|
|
|
|
|
|
/// Just a normal struct.
|
|
|
|
|
pub struct Foo;
|
|
|
|
|
|
2021-03-09 21:33:39 +01:00
|
|
|
impl Foo {
|
|
|
|
|
#[must_use]
|
2021-04-19 22:59:23 +02:00
|
|
|
pub fn must_use(&self) -> bool {
|
|
|
|
|
true
|
|
|
|
|
}
|
2021-03-09 21:33:39 +01:00
|
|
|
}
|
|
|
|
|
|
2021-02-21 14:25:12 +01:00
|
|
|
/// Just a normal enum.
|
2021-05-25 17:48:57 +02:00
|
|
|
#[doc(alias = "ThisIsAnAlias")]
|
2021-02-21 14:25:12 +01:00
|
|
|
pub enum WhoLetTheDogOut {
|
|
|
|
|
/// Woof!
|
|
|
|
|
Woof,
|
|
|
|
|
/// Meoooooooow...
|
|
|
|
|
Meow,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Who doesn't love to wrap a `format!` call?
|
|
|
|
|
pub fn some_more_function<T: fmt::Debug>(t: &T) -> String {
|
|
|
|
|
format!("{:?}", t)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Woohoo! A trait!
|
|
|
|
|
pub trait AnotherOne {
|
2021-03-12 14:25:01 +01:00
|
|
|
/// Some func 3.
|
|
|
|
|
fn func3();
|
|
|
|
|
|
2021-02-21 14:25:12 +01:00
|
|
|
/// Some func 1.
|
|
|
|
|
fn func1();
|
|
|
|
|
|
2021-03-12 14:25:01 +01:00
|
|
|
fn another();
|
|
|
|
|
fn why_not();
|
|
|
|
|
|
2021-02-21 14:25:12 +01:00
|
|
|
/// Some func 2.
|
|
|
|
|
fn func2();
|
|
|
|
|
|
2021-03-12 14:25:01 +01:00
|
|
|
fn hello();
|
2021-02-21 14:25:12 +01:00
|
|
|
}
|
|
|
|
|
|
2021-03-22 22:17:43 +01:00
|
|
|
/// ```compile_fail
|
|
|
|
|
/// whatever
|
|
|
|
|
/// ```
|
|
|
|
|
///
|
2021-02-21 14:25:12 +01:00
|
|
|
/// Check for "i" signs in lists!
|
|
|
|
|
///
|
|
|
|
|
/// 1. elem 1
|
2021-03-22 22:17:43 +01:00
|
|
|
/// 2. test 1
|
|
|
|
|
/// ```compile_fail
|
|
|
|
|
/// fn foo() {}
|
|
|
|
|
/// ```
|
2021-02-21 14:25:12 +01:00
|
|
|
/// 3. elem 3
|
|
|
|
|
/// 4. ```ignore (it's a test)
|
|
|
|
|
/// fn foo() {}
|
|
|
|
|
/// ```
|
|
|
|
|
/// 5. elem 5
|
2021-03-22 22:17:43 +01:00
|
|
|
///
|
|
|
|
|
/// Final one:
|
|
|
|
|
///
|
|
|
|
|
/// ```ignore (still a test)
|
|
|
|
|
/// let x = 12;
|
|
|
|
|
/// ```
|
2021-02-21 14:25:12 +01:00
|
|
|
pub fn check_list_code_block() {}
|
2021-04-19 22:59:23 +02:00
|
|
|
|
2021-06-24 14:30:01 +02:00
|
|
|
/// a thing with a label
|
|
|
|
|
#[deprecated(since = "1.0.0", note = "text why this deprecated")]
|
|
|
|
|
#[doc(cfg(unix))]
|
|
|
|
|
pub fn replaced_function() {}
|
|
|
|
|
|
2021-04-19 22:59:23 +02:00
|
|
|
pub enum AnEnum {
|
|
|
|
|
WithVariants { and: usize, sub: usize, variants: usize },
|
|
|
|
|
}
|
2021-05-21 22:53:50 +02:00
|
|
|
|
|
|
|
|
#[doc(keyword = "CookieMonster")]
|
|
|
|
|
pub mod keyword {}
|
2021-06-06 23:06:49 +02:00
|
|
|
|
|
|
|
|
/// Just some type alias.
|
|
|
|
|
pub type SomeType = u32;
|