externally_driven_async_rt/net/
borrowed_write_half.rs1use crate::{context::Context, net::socket::Socket, state::State};
2
3#[must_use]
5pub struct BorrowedWriteHalf<'s> {
6 socket: &'s Socket,
7}
8
9impl<'s> BorrowedWriteHalf<'s> {
10 pub(crate) const fn new(socket: &'s Socket) -> Self {
11 Self { socket }
12 }
13
14 pub fn write<
16 'a,
17 S: State,
18 const TASKS: usize,
19 const TASK_SIZE: usize,
20 const ROOT_TASK_SIZE: usize,
21 const TIMERS: usize,
22 const FDS: usize,
23 >(
24 &'a mut self,
25 ctx: &'a Context<'_, S, TASKS, TASK_SIZE, ROOT_TASK_SIZE, TIMERS, FDS>,
26 buf: &'a [u8],
27 ) -> impl Future<Output = rustix::io::Result<usize>> {
28 self.socket.write(ctx, buf)
29 }
30}
31
32impl core::fmt::Debug for BorrowedWriteHalf<'_> {
33 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
34 f.write_str("BorrowedWriteHalf")
35 }
36}