Rust

Doc comments (///) & rustdoc

Në shqip: Komentet e dokumentimit në Rust

ShpjegimiSQ

Komentet me /// mbi funksione dhe struct-e bëhen dokumentacion HTML me cargo doc. Shembujt e kodit brenda tyre ekzekutohen si teste — kështu dokumentacioni s'del kurrë jashtë kohe.

EnglishEN

/// comments above functions and structs become HTML documentation with cargo doc. Code examples inside them run as tests — so the docs never go out of date.

Si ta mendosh

Si udhëzimet që provohen çdo herë që shtypet manuali.

Lexoje në anglisht

Like instructions that get tested every time the manual is printed.

Shembull kodirust

/// Kthen mesataren e notave.
/// ```
/// assert_eq!(fjalori::mesatarja(&[4, 6]), 5.0);
/// ```
pub fn mesatarja(v: &[i32]) -> f64 { v.iter().sum::<i32>() as f64 / v.len() as f64 }

Terma të lidhur