Struct nix::sys::aio::AioWritev

source ·
#[repr(transparent)]
pub struct AioWritev<'a> { /* private fields */ }
Available on crate feature aio only.
Expand description

Asynchronously writes from a scatter/gather list of buffers to a file descriptor.

References

aio_writev

Examples

const wbuf0: &[u8] = b"abcdef";
const wbuf1: &[u8] = b"123456";
let len = wbuf0.len() + wbuf1.len();
let wbufs = [IoSlice::new(wbuf0), IoSlice::new(wbuf1)];
let mut f = tempfile().unwrap();
let mut aiow = Box::pin(
   AioWritev::new(
       f.as_raw_fd(),
       2,   //offset
       &wbufs,
       0,   //priority
       SigevNotify::SigevNone
   )
);
aiow.as_mut().submit().unwrap();
while (aiow.as_mut().error() == Err(Errno::EINPROGRESS)) {
   thread::sleep(time::Duration::from_millis(10));
}
assert_eq!(aiow.as_mut().aio_return().unwrap(), len);

Implementations§

Returns the number of buffers the operation will read into.

Construct a new AioWritev.

Arguments
  • fd: File descriptor to write to
  • offs: File offset
  • bufs: A scatter/gather list of memory buffers. They must outlive the AioWritev.
  • prio: If POSIX Prioritized IO is supported, then the operation will be prioritized at the process’s priority level minus prio
  • sigev_notify: Determines how you will be notified of event completion.

Returns the file offset of the operation.

Trait Implementations§

The return type of Aio::aio_return.
Cancels an outstanding AIO request. Read more
Retrieve error status of an asynchronous operation. Read more
Returns the underlying file descriptor associated with the operation.
Does this operation currently have any in-kernel state? Read more
Returns the priority of the AioCb
Update the notification settings for an existing AIO operation that has not yet been submitted.
Returns the SigEvent that will be used for notification.
Retrieve return status of an asynchronous operation. Read more
Actually start the I/O operation. Read more
Converts this type into a mutable reference of the (usually inferred) input type.
Converts this type into a shared reference of the (usually inferred) input type.
Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.