Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Comments on Proper location of docstring on struct with attributes
Post
Proper location of docstring on struct with attributes
+2
−1
When documenting a struct with attributes, where does the docstring go? Before or after the attribute(s)?
Option 1:
/// Does it go here?
#[derive(Deserialize, Debug)]
pub struct Metadata {
pub version: f32,
pub contributors: Vec<String>
}
Option 2:
#[derive(Deserialize, Debug)]
/// Does it go here?
pub struct Metadata {
pub version: f32,
pub contributors: Vec<String>
}
Option 3 (presumably wrong but adding just in case):
#[derive(Deserialize, Debug)]
pub struct Metadata {
/// Does it go here? (I assume this would document `version`,
/// not the struct)
pub version: f32,
pub contributors: Vec<String>
}
1 comment thread