Compute the indentation of s, or None of an empty line.
(s: &str)
| 251 | |
| 252 | /// Compute the indentation of s, or None of an empty line. |
| 253 | fn _indent(s: &str) -> Option<usize> { |
| 254 | if s.is_empty() { |
| 255 | None |
| 256 | } else { |
| 257 | let t = s.trim_start(); |
| 258 | Some(s.len() - t.len()) |
| 259 | } |
| 260 | } |
| 261 | |
| 262 | /// Given a multi-line string, split it into a sequence of lines after |
| 263 | /// stripping a common indentation. This is useful for strings defined with |