[−][src]Struct rio::Rio
Nice bindings for the shiny new linux IO system
Methods
impl Uring
[src]
pub fn accept<'uring, 'listener>(
&'uring self,
tcp_listener: &'listener TcpListener
) -> Result<Completion<'listener, TcpStream>> where
'listener: 'uring,
'uring: 'listener,
[src]
&'uring self,
tcp_listener: &'listener TcpListener
) -> Result<Completion<'listener, TcpStream>> where
'listener: 'uring,
'uring: 'listener,
Asynchronously accepts a TcpStream
from
a provided TcpListener
.
Warning
This only becomes usable on linux kernels 5.5 and up.
pub fn send<'uring, 'stream, 'buf, F, B>(
&'uring self,
stream: &'stream F,
iov: B
) -> Result<Completion<'buf, usize>> where
'stream: 'uring + 'buf,
'buf: 'uring + 'stream,
'uring: 'buf + 'stream,
F: AsRawFd,
B: 'buf + AsIoVec,
[src]
&'uring self,
stream: &'stream F,
iov: B
) -> Result<Completion<'buf, usize>> where
'stream: 'uring + 'buf,
'buf: 'uring + 'stream,
'uring: 'buf + 'stream,
F: AsRawFd,
B: 'buf + AsIoVec,
Send a buffer to the target socket or file-like destination.
Returns the length that was successfully written.
Warning
This only becomes usable on linux kernels 5.6 and up.
pub fn send_ordered<'uring, 'stream, 'buf, F, B>(
&'uring self,
stream: &'stream F,
iov: B,
ordering: Ordering
) -> Result<Completion<'buf, usize>> where
'stream: 'uring + 'buf,
'buf: 'uring + 'stream,
'uring: 'buf + 'stream,
F: AsRawFd,
B: 'buf + AsIoVec,
[src]
&'uring self,
stream: &'stream F,
iov: B,
ordering: Ordering
) -> Result<Completion<'buf, usize>> where
'stream: 'uring + 'buf,
'buf: 'uring + 'stream,
'uring: 'buf + 'stream,
F: AsRawFd,
B: 'buf + AsIoVec,
Send a buffer to the target socket or file-like destination.
Returns the length that was successfully written.
Accepts an Ordering
specification.
Warning
This only becomes usable on linux kernels 5.6 and up.
pub fn recv<'uring, 'stream, 'buf, F, B>(
&'uring self,
stream: &'stream F,
iov: B
) -> Result<Completion<'buf, usize>> where
'stream: 'uring + 'buf,
'buf: 'uring + 'stream,
'uring: 'buf + 'stream,
F: AsRawFd,
B: 'buf + AsIoVec + AsIoVecMut,
[src]
&'uring self,
stream: &'stream F,
iov: B
) -> Result<Completion<'buf, usize>> where
'stream: 'uring + 'buf,
'buf: 'uring + 'stream,
'uring: 'buf + 'stream,
F: AsRawFd,
B: 'buf + AsIoVec + AsIoVecMut,
Receive data from the target socket or file-like destination, and place it in the given buffer.
Returns the length that was successfully read.
Warning
This only becomes usable on linux kernels 5.6 and up.
pub fn recv_ordered<'uring, 'stream, 'buf, F, B>(
&'uring self,
stream: &'stream F,
iov: B,
ordering: Ordering
) -> Result<Completion<'buf, usize>> where
'stream: 'uring + 'buf,
'buf: 'uring + 'stream,
'uring: 'buf + 'stream,
F: AsRawFd,
B: 'buf + AsIoVec + AsIoVecMut,
[src]
&'uring self,
stream: &'stream F,
iov: B,
ordering: Ordering
) -> Result<Completion<'buf, usize>> where
'stream: 'uring + 'buf,
'buf: 'uring + 'stream,
'uring: 'buf + 'stream,
F: AsRawFd,
B: 'buf + AsIoVec + AsIoVecMut,
Receive data from the target socket or file-like destination, and place it in the given buffer.
Returns the length that was successfully read.
Accepts an Ordering
specification.
Warning
This only becomes usable on linux kernels 5.6 and up.
pub fn fsync<'uring, 'file>(
&'uring self,
file: &'file File
) -> Result<Completion<'file, ()>> where
'file: 'uring,
'uring: 'file,
[src]
&'uring self,
file: &'file File
) -> Result<Completion<'file, ()>> where
'file: 'uring,
'uring: 'file,
Flushes all buffered writes, and associated metadata changes.
Warning
You usually don't want to do this without
linking to a previous write, because
io_uring
will execute operations out-of-order.
Without setting a Link
ordering on the previous
operation, or using fsync_ordered
with
the Drain
ordering, causing all previous
operations to complete before itself.
Additionally, fsync does not ensure that the file actually exists in its parent directory. So, for new files, you must also fsync the parent directory.
This does nothing for files opened in
O_DIRECT
mode.
pub fn fsync_ordered<'uring, 'file>(
&'uring self,
file: &'file File,
ordering: Ordering
) -> Result<Completion<'file, ()>> where
'file: 'uring,
'uring: 'file,
[src]
&'uring self,
file: &'file File,
ordering: Ordering
) -> Result<Completion<'file, ()>> where
'file: 'uring,
'uring: 'file,
Flushes all buffered writes, and associated metadata changes.
You probably want to
either use a Link
ordering on a previous
write (or chain of separate writes), or
use the Drain
ordering on this operation.
You may pass in an Ordering
to specify
two different optional behaviors:
Ordering::Link
causes the next submitted operation to wait until this one finishes. Useful for things like file copy, fsync-after-write, or proxies.Ordering::Drain
causes all previously submitted operations to complete before this one begins.
Warning
fsync does not ensure that
the file actually exists in its parent
directory. So, for new files, you must
also fsync the parent directory.
This does nothing for files opened in
O_DIRECT
mode.
pub fn fdatasync<'uring, 'file>(
&'uring self,
file: &'file File
) -> Result<Completion<'file, ()>> where
'file: 'uring,
'uring: 'file,
[src]
&'uring self,
file: &'file File
) -> Result<Completion<'file, ()>> where
'file: 'uring,
'uring: 'file,
Flushes all buffered writes, and the specific metadata required to access the data. This will skip syncing metadata like atime.
You probably want to
either use a Link
ordering on a previous
write (or chain of separate writes), or
use the Drain
ordering on this operation
with the fdatasync_ordered
method.
Warning
fdatasync does not ensure that
the file actually exists in its parent
directory. So, for new files, you must
also fsync the parent directory.
This does nothing for files opened in
O_DIRECT
mode.
pub fn fdatasync_ordered<'uring, 'file>(
&'uring self,
file: &'file File,
ordering: Ordering
) -> Result<Completion<'file, ()>> where
'file: 'uring,
'uring: 'file,
[src]
&'uring self,
file: &'file File,
ordering: Ordering
) -> Result<Completion<'file, ()>> where
'file: 'uring,
'uring: 'file,
Flushes all buffered writes, and the specific metadata required to access the data. This will skip syncing metadata like atime.
You probably want to
either use a Link
ordering on a previous
write (or chain of separate writes), or
use the Drain
ordering on this operation.
You may pass in an Ordering
to specify
two different optional behaviors:
Ordering::Link
causes the next submitted operation to wait until this one finishes. Useful for things like file copy, fsync-after-write, or proxies.Ordering::Drain
causes all previously submitted operations to complete before this one begins.
Warning
fdatasync does not ensure that
the file actually exists in its parent
directory. So, for new files, you must
also fsync the parent directory.
This does nothing for files opened in
O_DIRECT
mode.
pub fn write_at<'uring, 'file, 'buf, F, B>(
&'uring self,
file: &'file F,
iov: B,
at: u64
) -> Result<Completion<'buf, usize>> where
'file: 'uring + 'buf,
'buf: 'uring + 'file,
'uring: 'buf + 'file,
F: AsRawFd,
B: 'buf + AsIoVec,
[src]
&'uring self,
file: &'file F,
iov: B,
at: u64
) -> Result<Completion<'buf, usize>> where
'file: 'uring + 'buf,
'buf: 'uring + 'file,
'uring: 'buf + 'file,
F: AsRawFd,
B: 'buf + AsIoVec,
Writes data at the provided buffer using
vectored IO. Be sure to check the returned
io_uring_cqe
's res
field to see if a
short write happened. This will contain
the number of bytes written.
Note that the file argument is generic for anything that supports AsRawFd: sockets, files, etc...
pub fn write_at_ordered<'uring, 'file, 'buf, F, B>(
&'uring self,
file: &'file F,
iov: B,
at: u64,
ordering: Ordering
) -> Result<Completion<'buf, usize>> where
'file: 'uring + 'buf,
'buf: 'uring + 'file,
'uring: 'buf + 'file,
F: AsRawFd,
B: 'buf + AsIoVec,
[src]
&'uring self,
file: &'file F,
iov: B,
at: u64,
ordering: Ordering
) -> Result<Completion<'buf, usize>> where
'file: 'uring + 'buf,
'buf: 'uring + 'file,
'uring: 'buf + 'file,
F: AsRawFd,
B: 'buf + AsIoVec,
Writes data at the provided buffer using vectored IO.
Be sure to check the returned
io_uring_cqe
's res
field to see if a
short write happened. This will contain
the number of bytes written.
You may pass in an Ordering
to specify
two different optional behaviors:
Ordering::Link
causes the next submitted operation to wait until this one finishes. Useful for things like file copy, fsync-after-write, or proxies.Ordering::Drain
causes all previously submitted operations to complete before this one begins.
Note that the file argument is generic for anything that supports AsRawFd: sockets, files, etc...
pub fn read_at<'uring, 'file, 'buf, F, B>(
&'uring self,
file: &'file F,
iov: &'buf B,
at: u64
) -> Result<Completion<'buf, usize>> where
'file: 'uring + 'buf,
'buf: 'uring + 'file,
'uring: 'buf + 'file,
F: AsRawFd,
B: AsIoVec + AsIoVecMut,
[src]
&'uring self,
file: &'file F,
iov: &'buf B,
at: u64
) -> Result<Completion<'buf, usize>> where
'file: 'uring + 'buf,
'buf: 'uring + 'file,
'uring: 'buf + 'file,
F: AsRawFd,
B: AsIoVec + AsIoVecMut,
Reads data into the provided buffer from the
given file-like object, at the given offest,
using vectored IO. Be sure to check the returned
io_uring_cqe
's res
field to see if a
short read happened. This will contain
the number of bytes read.
Note that the file argument is generic for anything that supports AsRawFd: sockets, files, etc...
pub fn read_at_ordered<'uring, 'file, 'buf, F, B>(
&'uring self,
file: &'file F,
iov: &'buf B,
at: u64,
ordering: Ordering
) -> Result<Completion<'buf, usize>> where
'file: 'uring + 'buf,
'buf: 'uring + 'file,
'uring: 'buf + 'file,
F: AsRawFd,
B: AsIoVec + AsIoVecMut,
[src]
&'uring self,
file: &'file F,
iov: &'buf B,
at: u64,
ordering: Ordering
) -> Result<Completion<'buf, usize>> where
'file: 'uring + 'buf,
'buf: 'uring + 'file,
'uring: 'buf + 'file,
F: AsRawFd,
B: AsIoVec + AsIoVecMut,
Reads data into the provided buffer using
vectored IO. Be sure to check the returned
io_uring_cqe
's res
field to see if a
short read happened. This will contain
the number of bytes read.
You may pass in an Ordering
to specify
two different optional behaviors:
Ordering::Link
causes the next submitted operation to wait until this one finishes. Useful for things like file copy, fsync-after-write, or proxies.Ordering::Drain
causes all previously submitted operations to complete before this one begins.
Note that the file argument is generic for anything that supports AsRawFd: sockets, files, etc...
pub fn nop<'uring>(&'uring self) -> Result<Completion<'uring, ()>>
[src]
Don't do anything. This is mostly for debugging and tuning.
pub fn nop_ordered<'uring>(
&'uring self,
ordering: Ordering
) -> Result<Completion<'uring, ()>>
[src]
&'uring self,
ordering: Ordering
) -> Result<Completion<'uring, ()>>
Don't do anything. This is mostly for debugging and tuning.
pub fn submit_all(&self) -> Result<()>
[src]
Block until all items in the submission queue
are submitted to the kernel. This can
be avoided by using the SQPOLL
mode
(a privileged operation) on the Config
struct.
Note that this is performed automatically
and in a more fine-grained way when a
Completion
is consumed via Completion::wait
or awaited in a Future context.
You don't need to call this if you are
calling .wait()
or .await
on the
Completion
quickly, but if you are
doing some other stuff that could take
a while first, calling this will ensure
that the operation is being executed
by the kernel in the mean time.
Trait Implementations
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,