Write one marker line in the exact format of the output layer: `MARKER ID [HASH8]` + newline (the hash part only when supplied).
(&mut self, marker: &str, id: usize, changes: Option<&[Hash]>)
| 471 | /// Write one marker line in the exact format of the output layer: |
| 472 | /// `MARKER ID [HASH8]` + newline (the hash part only when supplied). |
| 473 | fn write_marker(&mut self, marker: &str, id: usize, changes: Option<&[Hash]>) { |
| 474 | self.ensure_line_start(); |
| 475 | self.out |
| 476 | .extend_from_slice(format!("{marker} {id}").as_bytes()); |
| 477 | if let Some(hash) = changes.and_then(|c| c.first()) { |
| 478 | let hash_str = hash.to_base32(); |
| 479 | let short = if hash_str.len() > 8 { |
| 480 | &hash_str[..8] |
| 481 | } else { |
| 482 | &hash_str |
| 483 | }; |
| 484 | self.out.extend_from_slice(format!(" [{short}]").as_bytes()); |
| 485 | } |
| 486 | self.out.push(b'\n'); |
| 487 | self.line += 1; |
| 488 | self.at_line_start = true; |
| 489 | } |
| 490 | |
| 491 | fn close_side(&mut self) { |
| 492 | if let Some(mut side) = self.current_side.take() { |
no test coverage detected