January 2018
Beginner to intermediate
454 pages
10h 8m
English
When we want to document an enumeration, we want not only to document the type, but also each variant. To do so, we can simply add a doc-comment before each variant. The same applies for a structure, for its fields.
Let's see an example for the Command type:
/// An FTP command parsed by the parser. #[derive(Clone, Debug, PartialEq)] pub enum Command { Auth, /// Change the working directory to the one specified as an argument. Cwd(PathBuf), /// Get a list of files. List(Option<PathBuf>), /// Create a new directory. Mkd(PathBuf), /// No operation. NoOp, /// Specify the port to use for the data channel. Port(u16), /// Enter passive mode. Pasv, /// Print current directory. Pwd, /// Terminate ...Read now
Unlock full access