From 183d3dada7d50c2bc8a129805e8dfae4bb3255dd Mon Sep 17 00:00:00 2001 From: marin postma Date: Thu, 28 Oct 2021 10:33:04 +0200 Subject: [PATCH] return document count from builder --- milli/src/documents/builder.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/milli/src/documents/builder.rs b/milli/src/documents/builder.rs index 6ba890b79..f95fa9190 100644 --- a/milli/src/documents/builder.rs +++ b/milli/src/documents/builder.rs @@ -62,7 +62,7 @@ impl DocumentBatchBuilder { /// This method must be called after the document addition is terminated. It will put the /// metadata at the end of the file, and write the metadata offset at the beginning on the /// file. - pub fn finish(self) -> Result<(), Error> { + pub fn finish(self) -> Result { let Self { inner: ByteCounter { mut writer, count: offset }, index, count, .. } = self; let meta = DocumentsMetadata { count, index }; @@ -74,7 +74,7 @@ impl DocumentBatchBuilder { writer.flush()?; - Ok(()) + Ok(count) } /// Extends the builder with json documents from a reader.