From 74fa93229de40ff9d8a4ec3dee061925764a22a1 Mon Sep 17 00:00:00 2001 From: ccamel Date: Thu, 15 Jun 2023 20:42:55 +0200 Subject: [PATCH] refactor(cognitarium): return writer from finish function --- contracts/okp4-cognitarium/src/rdf/serde.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/contracts/okp4-cognitarium/src/rdf/serde.rs b/contracts/okp4-cognitarium/src/rdf/serde.rs index 66d4ad61..f9d3bd63 100644 --- a/contracts/okp4-cognitarium/src/rdf/serde.rs +++ b/contracts/okp4-cognitarium/src/rdf/serde.rs @@ -68,7 +68,7 @@ impl TripleReader { } impl TripleWriter { - pub fn new(format: DataFormat, dst: W) -> Self { + pub fn new(format: &DataFormat, dst: W) -> Self { TripleWriter { writer: match format { DataFormat::RDFXml => TriplesWriterKind::RdfXml(RdfXmlFormatter::new(dst)), @@ -110,7 +110,7 @@ impl TripleWriter { Ok(()) } - pub fn finish(self) -> io::Result<()> { + pub fn finish(self) -> io::Result { match self.writer { TriplesWriterKind::Turtle(formatter) => formatter.finish(), TriplesWriterKind::NTriples(formatter) => formatter.finish(), @@ -120,7 +120,6 @@ impl TripleWriter { Err(e) => Err(io::Error::new(io::ErrorKind::Other, e.to_string())), }, } - .map(|_| ()) } }