use crate::io::{self, BorrowedCursor, IoSlice, IoSliceMut};
use crate::os::unix::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, RawFd};
use crate::sys::fd::FileDesc;
use crate::sys::unsupported::unsupported;
use crate::sys_common::{FromInner, IntoInner};
pub struct AnonPipe(FileDesc);
pub fn anon_pipe() -> io::Result<(AnonPipe, AnonPipe)> {
unsupported()
}
impl AnonPipe {
pub fn read(&self, _buf: &mut [u8]) -> io::Result<usize> {
unsupported()
}
pub fn read_buf(&self, _buf: BorrowedCursor<'_>) -> io::Result<()> {
unsupported()
}
pub fn read_vectored(&self, _bufs: &mut [IoSliceMut<'_>]) -> io::Result<usize> {
unsupported()
}
pub fn is_read_vectored(&self) -> bool {
false
}
#[allow(clippy::ptr_arg)]
pub fn read_to_end(&self, _buf: &mut Vec<u8>) -> io::Result<usize> {
unsupported()
}
pub fn write(&self, _buf: &[u8]) -> io::Result<usize> {
unsupported()
}
pub fn write_vectored(&self, _bufs: &[IoSlice<'_>]) -> io::Result<usize> {
unsupported()
}
pub fn is_write_vectored(&self) -> bool {
false
}
}
impl IntoInner<FileDesc> for AnonPipe {
fn into_inner(self) -> FileDesc {
self.0
}
}
#[allow(clippy::ptr_arg)]
pub fn read2(_p1: AnonPipe, _v1: &mut Vec<u8>, _p2: AnonPipe, _v2: &mut Vec<u8>) -> io::Result<()> {
unsupported()
}
impl AsRawFd for AnonPipe {
fn as_raw_fd(&self) -> RawFd {
self.0.as_raw_fd()
}
}
impl AsFd for AnonPipe {
fn as_fd(&self) -> BorrowedFd<'_> {
self.0.as_fd()
}
}
impl IntoRawFd for AnonPipe {
fn into_raw_fd(self) -> RawFd {
self.0.into_raw_fd()
}
}
impl FromRawFd for AnonPipe {
unsafe fn from_raw_fd(raw_fd: RawFd) -> Self {
Self(FromRawFd::from_raw_fd(raw_fd))
}
}
impl FromInner<FileDesc> for AnonPipe {
fn from_inner(fd: FileDesc) -> Self {
Self(fd)
}
}