(s: &Spec, body: &str)
| 344 | } |
| 345 | |
| 346 | fn pad_string(s: &Spec, body: &str) -> String { |
| 347 | let len = body.chars().count(); |
| 348 | if len >= s.width { return body.to_string(); } |
| 349 | let pad = s.width - len; |
| 350 | // Strings can't use '=' alignment; a zero-fill default becomes left-align. |
| 351 | let align = match s.align.unwrap_or(b'<') { b'=' => b'<', a => a }; |
| 352 | pad_with(body, pad, align, s.fill, 0) |
| 353 | } |
| 354 | |
| 355 | fn pad_aligned(s: &Spec, body: &str, sign_prefix_len: usize) -> String { |
| 356 | let len = body.chars().count(); |
no test coverage detected