(
visitor: &mut V,
version: u8,
tx_offset: u64,
reader: &mut R,
decode_txdata: F,
)
| 586 | } |
| 587 | |
| 588 | fn process_record<'a, V, R, F, T>( |
| 589 | visitor: &mut V, |
| 590 | version: u8, |
| 591 | tx_offset: u64, |
| 592 | reader: &mut R, |
| 593 | decode_txdata: F, |
| 594 | ) -> Result<T, DecoderError<V::Error>> |
| 595 | where |
| 596 | V: Visitor, |
| 597 | V::Row: Encode, |
| 598 | R: BufReader<'a>, |
| 599 | F: FnOnce(&mut V, &mut R) -> Result<T, V::Error>, |
| 600 | { |
| 601 | if version > Txdata::<V::Row>::VERSION { |
| 602 | return Err(DecoderError::UnsupportedVersion { |
| 603 | supported: Txdata::<V::Row>::VERSION, |
| 604 | given: version, |
| 605 | }); |
| 606 | } |
| 607 | visitor.visit_tx_start(tx_offset).map_err(DecoderError::Visitor)?; |
| 608 | let record = decode_txdata(visitor, reader).map_err(DecoderError::Visitor)?; |
| 609 | visitor.visit_tx_end().map_err(DecoderError::Visitor)?; |
| 610 | |
| 611 | Ok(record) |
| 612 | } |
| 613 | |
| 614 | #[cfg(test)] |
| 615 | mod tests { |
no test coverage detected
searching dependent graphs…