diff --git a/lib/src/store/numeric_encoder.rs b/lib/src/store/numeric_encoder.rs index ce6776ca..694beb3e 100644 --- a/lib/src/store/numeric_encoder.rs +++ b/lib/src/store/numeric_encoder.rs @@ -3,7 +3,7 @@ use crate::model::vocab::xsd; use crate::model::xsd::Decimal; use crate::model::*; use crate::Result; -use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt}; +use byteorder::{LittleEndian, ReadBytesExt}; use chrono::format::{parse, Parsed, StrftimeItems}; use chrono::prelude::*; use failure::format_err; @@ -579,7 +579,7 @@ pub trait TermWriter { impl TermWriter for W { fn write_term(&mut self, term: EncodedTerm) -> Result<()> { - self.write_u8(term.type_id())?; + self.write_all(&term.type_id().to_le_bytes())?; match term { EncodedTerm::DefaultGraph => {} EncodedTerm::NamedNode { iri_id } => self.write_all(&iri_id.to_le_bytes())?, @@ -600,8 +600,8 @@ impl TermWriter for W { self.write_all(&value_id.to_le_bytes())?; } EncodedTerm::BooleanLiteral(_) => {} - EncodedTerm::FloatLiteral(value) => self.write_f32::(*value)?, - EncodedTerm::DoubleLiteral(value) => self.write_f64::(*value)?, + EncodedTerm::FloatLiteral(value) => self.write_all(&value.to_le_bytes())?, + EncodedTerm::DoubleLiteral(value) => self.write_all(&value.to_le_bytes())?, EncodedTerm::IntegerLiteral(value) => self.write_all(&value.to_le_bytes())?, EncodedTerm::DecimalLiteral(value) => self.write_all(&value.to_le_bytes())?, EncodedTerm::DateLiteral(value) => { diff --git a/lib/src/store/rocksdb.rs b/lib/src/store/rocksdb.rs index 7100fe52..7eecc173 100644 --- a/lib/src/store/rocksdb.rs +++ b/lib/src/store/rocksdb.rs @@ -5,7 +5,7 @@ use failure::format_err; use rocksdb::*; use std::io::Cursor; use std::iter::{empty, once}; -use std::mem::replace; +use std::mem::take; use std::path::Path; use std::str; @@ -502,7 +502,7 @@ impl RocksDbStoreAutoTransaction<'_> { .connection .store .db - .write(replace(&mut self.inner.batch, WriteBatch::default()))?; + .write(take(&mut self.inner.batch))?; } Ok(()) } diff --git a/wikibase/src/main.rs b/wikibase/src/main.rs index 487861f5..19e6dfce 100644 --- a/wikibase/src/main.rs +++ b/wikibase/src/main.rs @@ -97,7 +97,7 @@ where loader.update_loop(); }); - start_server(addr.to_string(), move |request| { + start_server(addr, move |request| { content_encoding::apply( request, handle_request(request, repository.connection().unwrap()),