Complete exercise: docs
This commit is contained in:
@@ -4,10 +4,17 @@
|
|||||||
//
|
//
|
||||||
// Once you've got the documentation here, run `cargo doc --no-deps --open` and take a look!
|
// Once you've got the documentation here, run `cargo doc --no-deps --open` and take a look!
|
||||||
|
|
||||||
|
//! A pumpkin is a cultivated winter squash in the genus Cucurbita.
|
||||||
|
//! The term is most commonly applied to round, orange-colored squash varieties,
|
||||||
|
//! but does not possess a scientific definition. It may be used in reference to
|
||||||
|
//! many different squashes of varied appearance and belonging to multiple species in the Cucurbita genus.
|
||||||
|
|
||||||
// 2. What about an image!? Add an image of a pumpkin to the end of the module-level documentation.
|
// 2. What about an image!? Add an image of a pumpkin to the end of the module-level documentation.
|
||||||
// The markdown format is 
|
// 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
|
// 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.
|
// 3. Document the Pumpkin struct.
|
||||||
// - The description on the index page should be "Big orange thing"
|
// - The description on the index page should be "Big orange thing"
|
||||||
// - Make a section header called "Recipes"
|
// - Make a section header called "Recipes"
|
||||||
@@ -15,8 +22,16 @@
|
|||||||
// - Document the "roundness" field, explaining that it is a percentage
|
// - Document the "roundness" field, explaining that it is a percentage
|
||||||
// - Document the "orangeness" field, explaining that it is a number from 8 to 27
|
// - Document the "orangeness" field, explaining that it is a number from 8 to 27
|
||||||
|
|
||||||
|
/// Big orange thing
|
||||||
|
///
|
||||||
|
/// # Recipes
|
||||||
|
///
|
||||||
|
/// Recipes will be coming soon.
|
||||||
pub struct Pumpkin {
|
pub struct Pumpkin {
|
||||||
|
/// `roundness` is a percentage that describes how round the pumpkin is.
|
||||||
|
/// 100% means perfectly round, while 0% means not round at all.
|
||||||
pub roundness: f32,
|
pub roundness: f32,
|
||||||
|
/// `orangeness` is a number from 8 to 27 that describes how orange the pumpkin is.
|
||||||
pub orangeness: i32,
|
pub orangeness: i32,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -24,12 +39,14 @@ pub struct Pumpkin {
|
|||||||
// can't be used for pie. :'-(
|
// can't be used for pie. :'-(
|
||||||
|
|
||||||
impl Pumpkin {
|
impl Pumpkin {
|
||||||
|
/// Smash the pumpkin. Once smashed, it cannot be used for pie.
|
||||||
pub fn smash(self) {}
|
pub fn smash(self) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 5. Document that BURNT_ORANGE is for the "orangeness" field in the Pumpkin struct.
|
// 5. Document that BURNT_ORANGE is for the "orangeness" field in the Pumpkin struct.
|
||||||
// - Link to the Pumpkin struct in your description
|
// - Link to the Pumpkin struct in your description
|
||||||
|
|
||||||
|
/// The `BURNT_ORANGE` constant is a value of 13 that can be used for the `orangeness` field in the [Pumpkin] struct.
|
||||||
pub const BURNT_ORANGE: i32 = 13;
|
pub const BURNT_ORANGE: i32 = 13;
|
||||||
|
|
||||||
// Challenge: Find the option to pass to `cargo doc` so that documentation for this private item
|
// Challenge: Find the option to pass to `cargo doc` so that documentation for this private item
|
||||||
|
|||||||
Reference in New Issue
Block a user