rust-ape-example/src/bin/meta_doc.rs
2022-09-07 11:36:05 +05:30

56 lines
1.1 KiB
Rust

// ./src/meta/doc.md
/*
#![crate_name = "doc"]
/// A human being is represented here
pub struct Person {
/// A person must have a name, no matter how much Juliet may hate it
name: String,
}
impl Person {
/// Returns a person with the name given them
///
/// # Arguments
///
/// * `name` - A string slice that holds the name of the person
///
/// # Examples
///
/// ```
/// // You can have rust code between fences inside the comments
/// // If you pass --test to `rustdoc`, it will even test it for you!
/// use doc::Person;
/// let person = Person::new("name");
/// ```
pub fn new(name: &str) -> Person {
Person {
name: name.to_string(),
}
}
/// Gives a friendly hello!
///
/// Says "Hello, [name](Person::name)" to the `Person` it is called on.
pub fn hello(& self) {
println!("Hello, {}!", self.name);
}
}
fn part0() {
let john = Person::new("John");
john.hello();
}
// Example from the futures-rs library
#[doc(hidden)]
pub use self::async_await::*;
*/
pub fn main() {
// part0();
}