Struct a10::io::Stderr

source ·
pub struct Stderr(/* private fields */);
Expand description

An AsyncFd for stderr.

§Notes

This directly writes to the raw file descriptor, which means it’s not buffered and will not flush anything buffered by the standard library.

When this type is dropped it will not close stderr.

Methods from Deref<Target = AsyncFd>§

source

pub fn cancel_all<'fd>(&'fd self) -> CancelAll<'fd>

Attempt to cancel all in progress operations on this fd.

If the I/O operations were succesfully canceled this returns Ok(n), where n is the number of operations canceled. The canceled operations will return ECANCELED to indicate they were canceled.

If no operations were found, for example if they were already completed, this will return Ok(0).

In general, operations that are interruptible (like socket IO) will get canceled, while disk IO operations cannot be canceled if already started.

§Notes

Due to the lazyness of Futures it is possible that this will return Ok(0) if operations were never polled only to start it after their first poll.

source

pub fn sync_all<'fd>(&'fd self) -> SyncData<'fd>

Sync all OS-internal metadata to disk.

§Notes

Any uncompleted writes may not be synced to disk.

source

pub fn sync_data<'fd>(&'fd self) -> SyncData<'fd>

This function is similar to sync_all, except that it may not synchronize file metadata to the filesystem.

This is intended for use cases that must synchronize content, but don’t need the metadata on disk. The goal of this method is to reduce disk operations.

§Notes

Any uncompleted writes may not be synced to disk.

source

pub fn metadata<'fd>(&'fd self) -> Stat<'fd>

Retrieve metadata about the file.

source

pub fn advise<'fd>( &'fd self, offset: u64, length: u32, advice: c_int ) -> Advise<'fd>

Predeclare an access pattern for file data.

Announce an intention to access file data in a specific pattern in the future, thus allowing the kernel to perform appropriate optimizations.

The advice applies to a (not necessarily existent) region starting at offset and extending for len bytes (or until the end of the file if len is 0). The advice is not binding; it merely constitutes an expectation on behalf of the application.

source

pub fn allocate<'fd>( &'fd self, offset: u64, length: u32, mode: c_int ) -> Allocate<'fd>

Manipulate file space.

Manipulate the allocated disk space for the file referred for the byte range starting at offset and continuing for length bytes.

source

pub fn read<'fd, B>(&'fd self, buf: B) -> Read<'fd, B>
where B: BufMut,

Read from this fd into buf.

source

pub fn read_at<'fd, B>(&'fd self, buf: B, offset: u64) -> Read<'fd, B>
where B: BufMut,

Read from this fd into buf starting at offset.

The current file cursor is not affected by this function. This means that a call read_at(buf, 1024) with a buffer of 1kb will not continue reading at 2kb in the next call to read.

source

pub fn read_n<'fd, B>(&'fd self, buf: B, n: usize) -> ReadN<'fd, B>
where B: BufMut,

Read at least n bytes from this fd into buf.

source

pub fn read_n_at<'fd, B>( &'fd self, buf: B, offset: u64, n: usize ) -> ReadN<'fd, B>
where B: BufMut,

Read at least n bytes from this fd into buf starting at offset.

The current file cursor is not affected by this function.

source

pub fn read_vectored<'fd, B, const N: usize>( &'fd self, bufs: B ) -> ReadVectored<'fd, B, N>
where B: BufMutSlice<N>,

Read from this fd into bufs.

source

pub fn read_vectored_at<'fd, B, const N: usize>( &'fd self, bufs: B, offset: u64 ) -> ReadVectored<'fd, B, N>
where B: BufMutSlice<N>,

Read from this fd into bufs starting at offset.

The current file cursor is not affected by this function.

source

pub fn read_n_vectored<'fd, B, const N: usize>( &'fd self, bufs: B, n: usize ) -> ReadNVectored<'fd, B, N>
where B: BufMutSlice<N>,

Read at least n bytes from this fd into bufs.

source

pub fn read_n_vectored_at<'fd, B, const N: usize>( &'fd self, bufs: B, offset: u64, n: usize ) -> ReadNVectored<'fd, B, N>
where B: BufMutSlice<N>,

Read at least n bytes from this fd into bufs.

The current file cursor is not affected by this function.

source

pub fn write<'fd, B>(&'fd self, buf: B) -> Write<'fd, B>
where B: Buf,

Write buf to this fd.

source

pub fn write_at<'fd, B>(&'fd self, buf: B, offset: u64) -> Write<'fd, B>
where B: Buf,

Write buf to this fd at offset.

The current file cursor is not affected by this function.

source

pub fn write_all<'fd, B>(&'fd self, buf: B) -> WriteAll<'fd, B>
where B: Buf,

Write all of buf to this fd.

source

pub fn write_all_at<'fd, B>(&'fd self, buf: B, offset: u64) -> WriteAll<'fd, B>
where B: Buf,

Write all of buf to this fd at offset.

The current file cursor is not affected by this function.

source

pub fn write_vectored<'fd, B, const N: usize>( &'fd self, bufs: B ) -> WriteVectored<'fd, B, N>
where B: BufSlice<N>,

Write bufs to this file.

source

pub fn write_vectored_at<'fd, B, const N: usize>( &'fd self, bufs: B, offset: u64 ) -> WriteVectored<'fd, B, N>
where B: BufSlice<N>,

Write bufs to this file at offset.

The current file cursor is not affected by this function.

source

pub fn write_all_vectored<'fd, B, const N: usize>( &'fd self, bufs: B ) -> WriteAllVectored<'fd, B, N>
where B: BufSlice<N>,

Write all bufs to this file.

source

pub fn write_all_vectored_at<'fd, B, const N: usize>( &'fd self, bufs: B, offset: u64 ) -> WriteAllVectored<'fd, B, N>
where B: BufSlice<N>,

Write all bufs to this file at offset.

The current file cursor is not affected by this function.

source

pub fn splice_to<'fd>( &'fd self, target: RawFd, length: u32, flags: c_int ) -> Splice<'fd>

Splice length bytes to target fd.

See the splice(2) manual for correct usage.

source

pub fn splice_to_at<'fd>( &'fd self, offset: u64, target: RawFd, target_offset: u64, length: u32, flags: c_int ) -> Splice<'fd>

Same as AsyncFd::splice_to, but starts reading data at offset from the file (instead of the current position of the read cursor) and starts writing at target_offset to target.

source

pub fn splice_from<'fd>( &'fd self, target: RawFd, length: u32, flags: c_int ) -> Splice<'fd>

Splice length bytes from target fd.

See the splice(2) manual for correct usage.

source

pub fn splice_from_at<'fd>( &'fd self, offset: u64, target: RawFd, target_offset: u64, length: u32, flags: c_int ) -> Splice<'fd>

Same as AsyncFd::splice_from, but starts reading writing at offset to the file (instead of the current position of the write cursor) and starts reading at target_offset from target.

source

pub fn connect<'fd, A>(&'fd self, address: impl Into<Box<A>>) -> Connect<'fd, A>
where A: SocketAddress,

Initiate a connection on this socket to the specified address.

source

pub fn send<'fd, B>(&'fd self, buf: B, flags: c_int) -> Send<'fd, B>
where B: Buf,

Sends data on the socket to a connected peer.

source

pub fn send_zc<'fd, B>(&'fd self, buf: B, flags: c_int) -> Send<'fd, B>
where B: Buf,

Same as AsyncFd::send, but tries to avoid making intermediate copies of buf.

§Notes

Zerocopy execution is not guaranteed and may fall back to copying. The request may also fail with EOPNOTSUPP, when a protocol doesn’t support zerocopy, in which case users are recommended to use AsyncFd::send instead.

The Future only returns once it safe for the buffer to be used again, for TCP for example this means until the data is ACKed by the peer.

source

pub fn send_all<'fd, B>(&'fd self, buf: B) -> SendAll<'fd, B>
where B: Buf,

Sends all data in buf on the socket to a connected peer. Returns io::ErrorKind::WriteZero if not all bytes could be written.

source

pub fn send_vectored<'fd, B, const N: usize>( &'fd self, bufs: B, flags: c_int ) -> SendMsg<'fd, B, NoAddress, N>
where B: BufSlice<N>,

Sends data in bufs on the socket to a connected peer.

source

pub fn send_vectored_zc<'fd, B, const N: usize>( &'fd self, bufs: B, flags: c_int ) -> SendMsg<'fd, B, NoAddress, N>
where B: BufSlice<N>,

Same as AsyncFd::send_vectored, but tries to avoid making intermediate copies of buf.

source

pub fn send_all_vectored<'fd, B, const N: usize>( &'fd self, bufs: B ) -> SendAllVectored<'fd, B, N>
where B: BufSlice<N>,

Sends all data in bufs on the socket to a connected peer, using vectored I/O. Returns io::ErrorKind::WriteZero if not all bytes could be written.

source

pub fn sendto<'fd, B, A>( &'fd self, buf: B, address: A, flags: c_int ) -> SendTo<'fd, B, A>
where B: Buf, A: SocketAddress,

Sends data on the socket to a connected peer.

source

pub fn sendto_zc<'fd, B, A>( &'fd self, buf: B, address: A, flags: c_int ) -> SendTo<'fd, B, A>
where B: Buf, A: SocketAddress,

Same as AsyncFd::sendto, but tries to avoid making intermediate copies of buf.

See AsyncFd::send_zc for additional notes.

source

pub fn sendto_vectored<'fd, B, A, const N: usize>( &'fd self, bufs: B, address: A, flags: c_int ) -> SendMsg<'fd, B, A, N>
where B: BufSlice<N>, A: SocketAddress,

Sends data in bufs on the socket to a connected peer.

source

pub fn sendto_vectored_zc<'fd, B, A, const N: usize>( &'fd self, bufs: B, address: A, flags: c_int ) -> SendMsg<'fd, B, A, N>
where B: BufSlice<N>, A: SocketAddress,

Same as AsyncFd::sendto_vectored, but tries to avoid making intermediate copies of buf.

source

pub fn recv<'fd, B>(&'fd self, buf: B, flags: c_int) -> Recv<'fd, B>
where B: BufMut,

Receives data on the socket from the remote address to which it is connected.

source

pub fn multishot_recv<'fd>( &'fd self, pool: ReadBufPool, flags: c_int ) -> MultishotRecv<'fd>

Continuously receive data on the socket from the remote address to which it is connected.

§Notes

This will return ENOBUFS if no buffer is available in the pool to read into.

Be careful when using this as a peer sending a lot data might take up all your buffers from your pool!

source

pub fn recv_n<'fd, B>(&'fd self, buf: B, n: usize) -> RecvN<'fd, B>
where B: BufMut,

Receives at least n bytes on the socket from the remote address to which it is connected.

source

pub fn recv_vectored<'fd, B, const N: usize>( &'fd self, bufs: B, flags: c_int ) -> RecvVectored<'fd, B, N>
where B: BufMutSlice<N>,

Receives data on the socket from the remote address to which it is connected, using vectored I/O.

source

pub fn recv_n_vectored<'fd, B, const N: usize>( &'fd self, bufs: B, n: usize ) -> RecvNVectored<'fd, B, N>
where B: BufMutSlice<N>,

Receives at least n bytes on the socket from the remote address to which it is connected, using vectored I/O.

source

pub fn recvfrom<'fd, B, A>( &'fd self, buf: B, flags: c_int ) -> RecvFrom<'fd, B, A>
where B: BufMut, A: SocketAddress,

Receives data on the socket and returns the source address.

source

pub fn recvfrom_vectored<'fd, B, A, const N: usize>( &'fd self, bufs: B, flags: c_int ) -> RecvFromVectored<'fd, B, A, N>
where B: BufMutSlice<N>, A: SocketAddress,

Receives data on the socket and the source address using vectored I/O.

source

pub fn shutdown<'fd>(&'fd self, how: Shutdown) -> Shutdown<'fd>

Shuts down the read, write, or both halves of this connection.

source

pub fn accept<'fd, A>(&'fd self) -> Accept<'fd, A>

Accept a new socket stream (AsyncFd).

If an accepted stream is returned, the remote address of the peer is returned along with it.

source

pub fn accept4<'fd, A>(&'fd self, flags: c_int) -> Accept<'fd, A>

Accept a new socket stream (AsyncFd) setting flags on the accepted socket.

Also see AsyncFd::accept.

source

pub fn multishot_accept<'fd>(&'fd self) -> MultishotAccept<'fd>

Accept multiple socket streams.

This is not the same as calling AsyncFd::accept in a loop as this uses a multishot operation, which means only a single operation is created kernel side, making this more efficient.

source

pub fn multishot_accept4<'fd>(&'fd self, flags: c_int) -> MultishotAccept<'fd>

Accept a new socket stream (AsyncFd) setting flags on the accepted socket.

Also see AsyncFd::multishot_accept.

source

pub fn socket_option<'fd, T>( &'fd self, level: c_int, optname: c_int ) -> SocketOption<'fd, T>

Get socket option.

At the time of writing this limited to the SOL_SOCKET level.

§Safety

The caller must ensure that T is the valid type for the option.

source

pub fn set_socket_option<'fd, T>( &'fd self, level: c_int, optname: c_int, optvalue: T ) -> SetSocketOption<'fd, T>

Set socket option.

At the time of writing this limited to the SOL_SOCKET level.

§Safety

The caller must ensure that T is the valid type for the option.

source

pub fn try_clone(&self) -> Result<AsyncFd>

Creates a new independently owned AsyncFd that shares the same underlying file descriptor as the existing AsyncFd.

Trait Implementations§

source§

impl Debug for Stderr

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Deref for Stderr

§

type Target = AsyncFd

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl Drop for Stderr

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl Freeze for Stderr

§

impl RefUnwindSafe for Stderr

§

impl Send for Stderr

§

impl Sync for Stderr

§

impl Unpin for Stderr

§

impl UnwindSafe for Stderr

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.