pub struct MsgWriterPipeStream { /* private fields */ }Expand description
Message stream writer for a named pipe.
Created either by using PipeListener or by connecting to a named pipe server.
Implementations§
Source§impl MsgWriterPipeStream
impl MsgWriterPipeStream
Sourcepub fn connect(name: impl AsRef<OsStr>) -> Result<Self>
pub fn connect(name: impl AsRef<OsStr>) -> Result<Self>
Connects to the specified named pipe (the \\.\pipe\ prefix is added automatically), blocking until a server instance is dispatched.
Sourcepub fn connect_to_remote(
pipe_name: impl AsRef<OsStr>,
hostname: impl AsRef<OsStr>,
) -> Result<Self>
pub fn connect_to_remote( pipe_name: impl AsRef<OsStr>, hostname: impl AsRef<OsStr>, ) -> Result<Self>
Connects to the specified named pipe at a remote computer (the \\<hostname>\pipe\ prefix is added automatically), blocking until a server instance is dispatched.
Sourcepub fn set_nonblocking(&self, nonblocking: bool) -> Result<()>
pub fn set_nonblocking(&self, nonblocking: bool) -> Result<()>
Sets whether the nonblocking mode for the pipe stream is enabled. By default, it is disabled.
In nonblocking mode, attempts to read from the pipe when there is no data available or to write when the buffer has filled up because the receiving side did not read enough bytes in time will never block like they normally do. Instead, a WouldBlock error is immediately returned, allowing the thread to perform useful actions in the meantime.
If called on the server side, the flag will be set only for one stream instance. A listener creation option, nonblocking, and a similar method on the listener, set_nonblocking, can be used to set the mode in bulk for all current instances and future ones.
Sourcepub fn is_server(&self) -> bool
pub fn is_server(&self) -> bool
Returns true if the stream was created by a listener (server-side), false if it was created by connecting to a server (server-side).
Sourcepub fn is_client(&self) -> bool
pub fn is_client(&self) -> bool
Returns true if the stream was created by connecting to a server (client-side), false if it was created by a listener (server-side).
Sourcepub fn client_process_id(&self) -> Result<u32>
pub fn client_process_id(&self) -> Result<u32>
Retrieves the process identifier of the client side of the named pipe connection.
Sourcepub fn client_session_id(&self) -> Result<u32>
pub fn client_session_id(&self) -> Result<u32>
Retrieves the session identifier of the client side of the named pipe connection.
Sourcepub fn server_process_id(&self) -> Result<u32>
pub fn server_process_id(&self) -> Result<u32>
Retrieves the process identifier of the server side of the named pipe connection.
Sourcepub fn server_session_id(&self) -> Result<u32>
pub fn server_session_id(&self) -> Result<u32>
Retrieves the session identifier of the server side of the named pipe connection.
Sourcepub fn disconnect_without_flushing(self) -> Result<()>
pub fn disconnect_without_flushing(self) -> Result<()>
Disconnects the named pipe stream without flushing buffers, causing all data in those buffers to be lost. This is much faster (and, in some case, the only finite-time way of ending things) than simply dropping the stream, since, for non-async named pipes, the Drop implementation flushes first.
Only makes sense for server-side pipes and will return an error if called on a client stream. For async pipe streams, this is the same as dropping the pipe.
Trait Implementations§
Source§impl Debug for MsgWriterPipeStream
impl Debug for MsgWriterPipeStream
Source§impl Drop for MsgWriterPipeStream
impl Drop for MsgWriterPipeStream
Source§impl PipeStream for MsgWriterPipeStream
impl PipeStream for MsgWriterPipeStream
Source§const ROLE: PipeStreamRole = PipeStreamRole::Writer
const ROLE: PipeStreamRole = PipeStreamRole::Writer
PipeStreamRole enumeration for more on what this means.Source§const WRITE_MODE: Option<PipeMode>
const WRITE_MODE: Option<PipeMode>
PipeMode::Bytes, message boundaries will broken and having READ_MODE at PipeMode::Messages would be a pipe creation error. Read moreSource§const READ_MODE: Option<PipeMode> = None
const READ_MODE: Option<PipeMode> = None
WRITE_MODE is PipeMode::Messages and READ_MODE is PipeMode::Bytes, the message boundaries will be destroyed when reading even though they are retained when written. See the PipeMode enumeration for more on what those modes mean. Read moreSource§impl Write for MsgWriterPipeStream
impl Write for MsgWriterPipeStream
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)