pub struct WindowsUnixStream { /* private fields */ }Expand description
An unix domain stream packet connection for Windows.
It requires WSA version 2.0 or 2.2 i.e Windows 10 and above.
The crate requests version 2.2 by default!
Is simular to the UnixStream but with some limitations:
-
no
SOCK_DGRAMorSOCK_SEQPACKETsupport -
Ancillary data like
SCM_RIGHTSSCM_CREDENTIALS -
Autobind feature
-
socketpair
§Examples
let path = "server3.sock";
let client = WindowsUnixStream::connect(path).unwrap();
client.send(b"first").unwrap();
client.send(b"second").unwrap();Implementations§
Source§impl WindowsUnixStream
impl WindowsUnixStream
Sourcepub fn connect<P: AsRef<Path>>(path: P) -> Result<Self, Error>
pub fn connect<P: AsRef<Path>>(path: P) -> Result<Self, Error>
Connects to an unix stream server listening at path.
This is a wrapper around connect_unix_addr()
for convenience and compatibility with std.
Sourcepub fn connect_unix_addr(addr: &UnixSocketAddr) -> Result<Self, Error>
pub fn connect_unix_addr(addr: &UnixSocketAddr) -> Result<Self, Error>
Connects to an unix seqpacket server listening at addr.
Sourcepub fn connect_from_to_unix_addr(
from: &UnixSocketAddr,
to: &UnixSocketAddr,
) -> Result<Self, Error>
pub fn connect_from_to_unix_addr( from: &UnixSocketAddr, to: &UnixSocketAddr, ) -> Result<Self, Error>
Binds to an address before connecting to a listening seqpacet socket.
pub fn try_clone(&self) -> Result<Self>
pub fn set_nonblocking(&self, nonblk: bool) -> Result<()>
Sourcepub fn set_no_inherit(&self, no_inh: bool) -> Result<()>
pub fn set_no_inherit(&self, no_inh: bool) -> Result<()>
Cloexec
pub fn set_write_timeout(&self, timeout: Option<Duration>) -> Result<()>
pub fn write_timeout(&self) -> Result<Option<Duration>>
pub fn set_read_timeout(&self, timeout: Option<Duration>) -> Result<()>
pub fn read_timeout(&self) -> Result<Option<Duration>>
Sourcepub fn local_unix_addr(&self) -> Result<UnixSocketAddr, Error>
pub fn local_unix_addr(&self) -> Result<UnixSocketAddr, Error>
Returns the address of this side of the connection.
Sourcepub fn peer_unix_addr(&self) -> Result<UnixSocketAddr, Error>
pub fn peer_unix_addr(&self) -> Result<UnixSocketAddr, Error>
Returns the address of the other side of the connection.
pub fn recv_vectored( &self, bufs: &mut [IoSliceMut<'_>], ) -> Result<(usize, RecvFlags)>
Sourcepub fn send_vectored(&self, bufs: Vec<IoSlice<'_>>) -> Result<usize>
pub fn send_vectored(&self, bufs: Vec<IoSlice<'_>>) -> Result<usize>
Windows consumes the io::IoSlice instances, so can no logner be accessed. The io::Write borrows, but it is not correct. DO not access the slices after it were sent.
Sourcepub fn take_error(&self) -> Result<Option<Error>, Error>
pub fn take_error(&self) -> Result<Option<Error>, Error>
Returns the value of the SO_ERROR option.
This might only provide errors generated from nonblocking connect()s,
which this library doesn’t support. It is therefore unlikely to be
useful, but is provided for parity with stream counterpart in std.
Trait Implementations§
Source§impl AsRawSocket for WindowsUnixStream
impl AsRawSocket for WindowsUnixStream
Source§fn as_raw_socket(&self) -> RawSocket
fn as_raw_socket(&self) -> RawSocket
Source§impl AsSocket for WindowsUnixStream
impl AsSocket for WindowsUnixStream
Source§fn as_socket(&self) -> BorrowedSocket<'_>
fn as_socket(&self) -> BorrowedSocket<'_>
Source§impl Debug for WindowsUnixStream
impl Debug for WindowsUnixStream
Source§impl From<OwnedSocket> for WindowsUnixStream
impl From<OwnedSocket> for WindowsUnixStream
Source§fn from(os: OwnedSocket) -> Self
fn from(os: OwnedSocket) -> Self
Source§impl From<WindowsUnixStream> for OwnedSocket
impl From<WindowsUnixStream> for OwnedSocket
Source§fn from(value: WindowsUnixStream) -> Self
fn from(value: WindowsUnixStream) -> Self
Source§impl FromRawSocket for WindowsUnixStream
impl FromRawSocket for WindowsUnixStream
Source§unsafe fn from_raw_socket(sock: RawSocket) -> Self
unsafe fn from_raw_socket(sock: RawSocket) -> Self
Source§impl IntoRawSocket for WindowsUnixStream
impl IntoRawSocket for WindowsUnixStream
Source§fn into_raw_socket(self) -> RawSocket
fn into_raw_socket(self) -> RawSocket
Source§impl Read for WindowsUnixStream
impl Read for WindowsUnixStream
Source§fn read(&mut self, buf: &mut [u8]) -> Result<usize>
fn read(&mut self, buf: &mut [u8]) -> Result<usize>
Source§fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize>
fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize>
read, except that it reads into a slice of buffers. Read moreSource§fn is_read_vectored(&self) -> bool
fn is_read_vectored(&self) -> bool
can_vector)1.0.0 · Source§fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>
buf. Read more1.0.0 · Source§fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>
fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>
buf. Read more1.6.0 · Source§fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
buf. Read moreSource§fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> Result<(), Error>
fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> Result<(), Error>
read_buf)Source§fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<(), Error>
fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<(), Error>
read_buf)cursor. Read more1.0.0 · Source§fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
Read. Read more1.0.0 · Source§fn chain<R>(self, next: R) -> Chain<Self, R>
fn chain<R>(self, next: R) -> Chain<Self, R>
Source§impl Write for WindowsUnixStream
impl Write for WindowsUnixStream
Source§fn write_vectored(&mut self, bufs: &[IoSlice<'_>]) -> Result<usize>
fn write_vectored(&mut self, bufs: &[IoSlice<'_>]) -> Result<usize>
Do not access bufs after sending!
Source§fn write(&mut self, buf: &[u8]) -> Result<usize>
fn write(&mut self, buf: &[u8]) -> Result<usize>
Source§fn flush(&mut self) -> Result<()>
fn flush(&mut self) -> Result<()>
Source§fn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
can_vector)1.0.0 · Source§fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
Source§fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
write_all_vectored)Source§impl<ESSR: EsInterfaceRegistry> XioEventPipe<ESSR> for WindowsUnixStream
impl<ESSR: EsInterfaceRegistry> XioEventPipe<ESSR> for WindowsUnixStream
Source§fn connect_event_pipe(
&mut self,
ess: &XioRegistry<ESSR>,
ev_uid: XioEventUid,
channel: XioChannel,
) -> XioResult<()>
fn connect_event_pipe( &mut self, ess: &XioRegistry<ESSR>, ev_uid: XioEventUid, channel: XioChannel, ) -> XioResult<()>
self to the endpoint which is provided by the argument
ess.Source§fn modify_event_pipe(
&mut self,
ess: &XioRegistry<ESSR>,
ev_uid: XioEventUid,
channel: XioChannel,
) -> XioResult<()>
fn modify_event_pipe( &mut self, ess: &XioRegistry<ESSR>, ev_uid: XioEventUid, channel: XioChannel, ) -> XioResult<()>
Source§fn disconnect_event_pipe(&mut self, ess: &XioRegistry<ESSR>) -> XioResult<()>
fn disconnect_event_pipe(&mut self, ess: &XioRegistry<ESSR>) -> XioResult<()>
self from the ess provided endpoint. An instance which
implements the logic should check that the ess matches the ess used when
self was initially registered (if available).