pub struct DocComment {
pub docs: Vec<String>,
}Expand description
Represents a documentation comment in C code, using the /// style syntax.
Documentation comments are special comments typically placed before function declarations, struct definitions, typedefs, and other code elements to document their purpose, parameters, return values, and other important information.
§Usage
Doc comments are typically used to document:
- Function signatures (parameters, return values, exceptions)
- Data structures and their fields
- Global variables and constants
- Type definitions
- File/module purpose
§Example
/// Calculates the square of a number
///
/// @param value The input number to square
/// @return The square of the input value
int square(int value);Fields§
§docs: Vec<String>Lines of documentation comment text.
Each line will be prefixed with /// during formatting.
Implementations§
Source§impl DocComment
impl DocComment
Sourcepub fn new() -> DocCommentBuilder
pub fn new() -> DocCommentBuilder
Creates and returns a new DocCommentBuilder to construct a DocComment using the builder pattern.
This method is the recommended entry point for creating documentation comments as it provides a fluent API for building multi-line documentation.
§Example
let doc_comment = DocComment::new()
.line_str("Calculates the factorial of a number")
.line_str("")
.line_str("@param n The input number")
.line_str("@return The factorial of n")
.build();Trait Implementations§
Auto Trait Implementations§
impl Freeze for DocComment
impl RefUnwindSafe for DocComment
impl Send for DocComment
impl Sync for DocComment
impl Unpin for DocComment
impl UnsafeUnpin for DocComment
impl UnwindSafe for DocComment
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more