src/backup/catalog.rs: clenup - use single impl block

This commit is contained in:
Dietmar Maurer 2019-11-10 11:38:31 +01:00
parent e8d8fdc61d
commit f89359c2f3

View File

@ -160,6 +160,12 @@ impl <W: Write> CatalogWriter<W> {
Ok(me)
}
fn write_all(&mut self, data: &[u8]) -> Result<(), Error> {
self.writer.write_all(data)?;
self.pos += u64::try_from(data.len())?;
Ok(())
}
pub fn finish(&mut self) -> Result<(), Error> {
if self.dirstack.len() != 1 {
bail!("unable to finish catalog at level {}", self.dirstack.len());
@ -257,14 +263,6 @@ impl <W: Write> BackupCatalogWriter for CatalogWriter<W> {
}
}
impl<W: Write> CatalogWriter<W> {
fn write_all(&mut self, data: &[u8]) -> Result<(), Error> {
self.writer.write_all(data)?;
self.pos += u64::try_from(data.len())?;
Ok(())
}
}
// fixme: move to somehere else?
/// Implement Write to tokio mpsc channel Sender
pub struct SenderWriter(tokio::sync::mpsc::Sender<Result<Vec<u8>, Error>>);