Properly document code with clear, accurate, and useful comments using the correct syntax based on context: 1. Use `///` to document items (structs, functions, etc.) that follow the comment:
Properly document code with clear, accurate, and useful comments using the correct syntax based on context:
///
to document items (structs, functions, etc.) that follow the comment:
/// Struct to store runtime state of the compute monitor thread.
/// Handles tracking Postgres availability and managing downtime metrics.
pub struct ComputeMonitor {
// ...
}
Use //!
for module or crate-level documentation that applies to the enclosing item.
/// Range of LSNs for page requests
/// - request_lsn: LSN specifically requested by compute
/// - effective_lsn: LSN actually used for the request (may differ from request_lsn)
/// Note: Primary computes typically use request_lsn == MAX
pub struct LsnRange {
pub request_lsn: Lsn,
pub effective_lsn: Lsn,
}
Ensure comments are accurate and up-to-date. Never merge incorrect comments with the intention to fix them later.
When referencing other code elements, use proper linking syntax: [
Type::method()]
to enable IDE navigation.
Good documentation serves as both a reference for users of your code and as context for future developers (including yourself) who will need to maintain it.
Enter the URL of a public GitHub repository