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:
@ -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)))
|
||||
}
|
@ -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;
|
||||
|
@ -1,2 +0,0 @@
|
||||
mod std_channel_writer;
|
||||
pub use std_channel_writer::StdChannelWriter;
|
@ -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(())
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user