Skip to content

Commit

Permalink
Merge pull request #419 from H1rono/doc-stream-writer-finish
Browse files Browse the repository at this point in the history
Write document of `StreamWriter::finish`
  • Loading branch information
fintelia authored Oct 30, 2023
2 parents f10238a + abbbd19 commit baea055
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1525,6 +1525,12 @@ impl<'a, W: Write> StreamWriter<'a, W> {
}
}

/// Consume the stream writer with validation.
///
/// Unlike a simple drop this ensures that the all data was written correctly. When other
/// validation options (chunk sequencing) had been turned on in the configuration of inner
/// [`Writer`], then it will also do a check on their correctness. Differently from
/// [`Writer::finish`], this just `flush`es, returns error if some data is abandoned.
pub fn finish(mut self) -> Result<()> {
if self.to_write > 0 {
let err = FormatErrorKind::MissingData(self.to_write).into();
Expand Down

0 comments on commit baea055

Please sign in to comment.