From 6d4fd4f074854c8fac1f9a1af606dae9a3a33977 Mon Sep 17 00:00:00 2001 From: Greg Burri Date: Mon, 5 Jul 2021 10:55:51 +0200 Subject: [PATCH] Add doc to a function --- ch2-str-simple-pattern/src/main.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/ch2-str-simple-pattern/src/main.rs b/ch2-str-simple-pattern/src/main.rs index b09af0a..51fccf0 100644 --- a/ch2-str-simple-pattern/src/main.rs +++ b/ch2-str-simple-pattern/src/main.rs @@ -43,13 +43,26 @@ fn main() { } } +/** +Process text lines from the given reader and try to find the given pattern. +*(This is just an example of inline documentation)* + +# Some random XML code + +``` xml + + + + +``` +*/ fn process_lines(reader: T, pattern_re: Regex) { for (i, line_result) in reader.lines().enumerate() { match line_result { Ok(line) => { let contains_substring = pattern_re.find(&line); match contains_substring { - Some(_) => println!("Found \"{}\" at line number {}", pattern_re, i + 1), + Some(_) => println!("Found \"{}\" in line number {}", pattern_re, i + 1), None => (), } }, -- 2.45.2