#[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
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§
source§impl<'a> AioWritev<'a>
impl<'a> AioWritev<'a>
sourcepub fn new(
fd: RawFd,
offs: off_t,
bufs: &[IoSlice<'a>],
prio: i32,
sigev_notify: SigevNotify
) -> Self
pub fn new(
fd: RawFd,
offs: off_t,
bufs: &[IoSlice<'a>],
prio: i32,
sigev_notify: SigevNotify
) -> Self
Construct a new AioWritev
.
Arguments
fd
: File descriptor to write tooffs
: File offsetbufs
: A scatter/gather list of memory buffers. They must outlive theAioWritev
.prio
: If POSIX Prioritized IO is supported, then the operation will be prioritized at the process’s priority level minusprio
sigev_notify
: Determines how you will be notified of event completion.
Trait Implementations§
source§impl<'a> Aio for AioWritev<'a>
impl<'a> Aio for AioWritev<'a>
§type Output = usize
type Output = usize
The return type of
Aio::aio_return
.source§fn cancel(self: Pin<&mut Self>) -> Result<AioCancelStat>
fn cancel(self: Pin<&mut Self>) -> Result<AioCancelStat>
Cancels an outstanding AIO request. Read more
source§fn error(self: Pin<&mut Self>) -> Result<()>
fn error(self: Pin<&mut Self>) -> Result<()>
Retrieve error status of an asynchronous operation. Read more
source§fn in_progress(&self) -> bool
fn in_progress(&self) -> bool
Does this operation currently have any in-kernel state? Read more
source§fn set_sigev_notify(&mut self, sev: SigevNotify)
fn set_sigev_notify(&mut self, sev: SigevNotify)
Update the notification settings for an existing AIO operation that has
not yet been submitted.