mirror of
https://github.com/ahgamut/rust-ape-example.git
synced 2024-05-15 01:52:42 +00:00
56 lines
1.1 KiB
Rust
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();
|
|
}
|
|
|