pub struct SendFuture<'ring, 'buf> { /* private fields */ }Expand description
Future for socket send operations.
This future sends data over a socket connection and returns the number of bytes sent along with buffer ownership when the operation completes. The future handles partial sends and error conditions appropriately.
§Type Parameters
'ring- Lifetime of the io_uring Ring instance'buf- Lifetime of the buffer containing data to send
§Returns
Returns (usize, Pin<&'buf mut [u8]>) on success where:
usizeis the number of bytes sentPin<&'buf mut [u8]>is the buffer that was sent from
§Examples
ⓘ
let mut ring = Ring::new(32)?;
let mut buffer = PinnedBuffer::from_slice(b"Hello, client!");
let stream = TcpStream::connect("127.0.0.1:8080")?;
stream.set_nonblocking(true)?;
let send_future = ring.send(stream.as_raw_fd(), buffer.as_mut_slice())?;
let (bytes_sent, _buffer) = send_future.await?;
println!("Sent {} bytes", bytes_sent);Trait Implementations§
Source§impl<'ring, 'buf> Drop for SendFuture<'ring, 'buf>
impl<'ring, 'buf> Drop for SendFuture<'ring, 'buf>
Auto Trait Implementations§
impl<'ring, 'buf> Freeze for SendFuture<'ring, 'buf>
impl<'ring, 'buf> !RefUnwindSafe for SendFuture<'ring, 'buf>
impl<'ring, 'buf> Send for SendFuture<'ring, 'buf>
impl<'ring, 'buf> Sync for SendFuture<'ring, 'buf>
impl<'ring, 'buf> Unpin for SendFuture<'ring, 'buf>
impl<'ring, 'buf> !UnwindSafe for SendFuture<'ring, 'buf>
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
Source§impl<F> IntoFuture for Fwhere
F: Future,
impl<F> IntoFuture for Fwhere
F: Future,
Source§type IntoFuture = F
type IntoFuture = F
Which kind of future are we turning this into?
Source§fn into_future(self) -> <F as IntoFuture>::IntoFuture
fn into_future(self) -> <F as IntoFuture>::IntoFuture
Creates a future from a value. Read more