Struct nix::sys::aio::AioWrite

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

Asynchronously writes from a buffer to a file descriptor

References

aio_write

Examples

const WBUF: &[u8] = b"abcdef123456";
let mut f = tempfile().unwrap();
let mut aiow = Box::pin(
    AioWrite::new(
        f.as_raw_fd(),
        2,   //offset
        WBUF,
        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(), WBUF.len());

Implementations§

Returns the requested length of the aio operation in bytes

This method returns the requested length of the operation. To get the number of bytes actually read or written by a completed operation, use aio_return instead.

Construct a new AioWrite.

Arguments
  • fd: File descriptor to write to
  • offs: File offset
  • buf: A memory buffer. It must outlive the AioWrite.
  • 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.