docs exercise
This commit is contained in:
35
exercise/docs/src/lib.rs
Normal file
35
exercise/docs/src/lib.rs
Normal file
@@ -0,0 +1,35 @@
|
||||
// 1. Thank you for volunteering to document our pumpkin library! Let's start by grabbing the first
|
||||
// paragraph from https://en.wikipedia.org/wiki/Pumpkin and pasting it as our module-level
|
||||
// documentation. Hint: Use inner-documentation comments.
|
||||
//
|
||||
// Once you've got the documentation here, run `cargo doc --no-deps --open` and take a look!
|
||||
|
||||
// 2. What about an image!? Add an image of a pumpkin to the end of the module-level documentation.
|
||||
// The markdown format is 
|
||||
// Here's the image to link to: https://upload.wikimedia.org/wikipedia/commons/thumb/5/5c/FrenchMarketPumpkinsB.jpg/700px-FrenchMarketPumpkinsB.jpg
|
||||
|
||||
// 3. Document the Pumpkin struct.
|
||||
// - The description on the index page should be "Big orange thing"
|
||||
// - Make a section header called "Recipes"
|
||||
// - Explain that recipes will be coming soon.
|
||||
// - Explain that "roundness" is a percentage
|
||||
// - Explain that "orangeness" is a number from 8 to 27
|
||||
|
||||
pub struct Pumpkin {
|
||||
pub roundness: f32,
|
||||
pub orangeness: i32,
|
||||
}
|
||||
|
||||
// 4. Explain that if you smash the pumpkin, it will be gone. Then it can't be used for pie. :'-(
|
||||
|
||||
impl Pumpkin {
|
||||
pub fn smash(self) {}
|
||||
}
|
||||
|
||||
// 5. Document that BURNT_ORANGE is for the "orangeness" field in the Pumpkin struct.
|
||||
// - Link to the Pumpkin struct in your description
|
||||
|
||||
pub const BURNT_ORANGE: i32 = 13;
|
||||
|
||||
// Challenge: Move the Pumpkin struct's documentation *inside* of the struct definition. Can you
|
||||
// see why that might not be the ideal approach?
|
||||
4
exercise/docs/src/main.rs
Normal file
4
exercise/docs/src/main.rs
Normal file
@@ -0,0 +1,4 @@
|
||||
/// The exercise is in lib.rs this time!!!
|
||||
fn main() {
|
||||
println!("Go look in lib.rs ;-)");
|
||||
}
|
||||
Reference in New Issue
Block a user