#[repr(transparent)]pub struct AioReadv<'a> { /* private fields */ }
Available on crate feature
aio
only.Expand description
Asynchronously reads from a file descriptor into a scatter/gather list of buffers.
References
Examples
const INITIAL: &[u8] = b"abcdef123456";
let mut rbuf0 = vec![0; 4];
let mut rbuf1 = vec![0; 2];
let expected_len = rbuf0.len() + rbuf1.len();
let mut rbufs = [IoSliceMut::new(&mut rbuf0), IoSliceMut::new(&mut rbuf1)];
let mut f = tempfile().unwrap();
f.write_all(INITIAL).unwrap();
{
let mut aior = Box::pin(
AioReadv::new(
f.as_raw_fd(),
2, //offset
&mut rbufs,
0, //priority
SigevNotify::SigevNone
)
);
aior.as_mut().submit().unwrap();
while (aior.as_mut().error() == Err(Errno::EINPROGRESS)) {
thread::sleep(time::Duration::from_millis(10));
}
assert_eq!(aior.as_mut().aio_return().unwrap(), expected_len);
}
assert_eq!(rbuf0, b"cdef");
assert_eq!(rbuf1, b"12");
Implementations§
source§impl<'a> AioReadv<'a>
impl<'a> AioReadv<'a>
sourcepub fn new(
fd: RawFd,
offs: off_t,
bufs: &mut [IoSliceMut<'a>],
prio: i32,
sigev_notify: SigevNotify
) -> Self
pub fn new( fd: RawFd, offs: off_t, bufs: &mut [IoSliceMut<'a>], prio: i32, sigev_notify: SigevNotify ) -> Self
Create a new AioReadv
, placing the data in a list of mutable slices.
Arguments
fd
: File descriptor to read fromoffs
: File offsetbufs
: A scatter/gather list of memory buffers. They must outlive theAioReadv
.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 AioReadv<'a>
impl<'a> Aio for AioReadv<'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.
Auto Trait Implementations§
impl<'a> RefUnwindSafe for AioReadv<'a>
impl<'a> Send for AioReadv<'a>
impl<'a> Sync for AioReadv<'a>
impl<'a> !Unpin for AioReadv<'a>
impl<'a> UnwindSafe for AioReadv<'a>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more