use proxmox-sys 0.2.1 and proxmox-io 1.0.1

And remove unused code from pbs-tools.

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
This commit is contained in:
Dietmar Maurer
2021-11-25 12:30:03 +01:00
parent 577095e2f7
commit 726b9d4469
9 changed files with 6 additions and 47 deletions

View File

@ -1,10 +0,0 @@
//! I/O utilities.
use proxmox_sys::fd::Fd;
/// safe wrapper for `nix::unistd::pipe2` defaulting to `O_CLOEXEC` and guarding the file
/// descriptors.
pub fn pipe() -> Result<(Fd, Fd), nix::Error> {
let (pin, pout) = nix::unistd::pipe2(nix::fcntl::OFlag::O_CLOEXEC)?;
Ok((Fd(pin), Fd(pout)))
}

View File

@ -1,12 +1,10 @@
pub mod cert;
pub mod crypt_config;
pub mod format;
pub mod io;
pub mod json;
pub mod lru_cache;
pub mod nom;
pub mod sha;
pub mod sync;
pub mod ticket;
pub mod async_lru_cache;

View File

@ -1,2 +0,0 @@
mod std_channel_writer;
pub use std_channel_writer::StdChannelWriter;

View File

@ -1,27 +0,0 @@
use std::io::Write;
use std::sync::mpsc::SyncSender;
use std::string::ToString;
/// Wrapper around SyncSender, which implements Write
///
/// Each write in translated into a send(Vec<u8>).
pub struct StdChannelWriter<E>(SyncSender<Result<Vec<u8>, E>>);
impl <E: ToString> StdChannelWriter<E> {
pub fn new(sender: SyncSender<Result<Vec<u8>, E>>) -> Self {
Self(sender)
}
}
impl <E: ToString> Write for StdChannelWriter<E> {
fn write(&mut self, buf: &[u8]) -> Result<usize, std::io::Error> {
self.0
.send(Ok(buf.to_vec()))
.map_err(|err| std::io::Error::new(std::io::ErrorKind::Other, err.to_string()))
.and(Ok(buf.len()))
}
fn flush(&mut self) -> Result<(), std::io::Error> {
Ok(())
}
}