1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Released under the MIT License.
// Copyright, 2026, by Samuel Williams.
use crate::{BufferPool, BufferPooling, SocketOperation, SocketStreamReader};
use std::io;
/// Construct sequential stream input bound to this scheduler. Backends can substitute their own static reader while keeping protocol code independent of registration and receive mechanisms.
///
/// The returned handle may borrow the scheduler, but never the temporary socket
/// reference. It retains backend access independently, so the socket and handle
/// can move together. Retire and drop handles before exclusively closing the socket.
pub trait SocketStreamReading: SocketOperation + BufferPooling {
/// Retain the socket and reusable backend state without submitting a receive or allocating a payload pool. Owned reads initialize default storage lazily.
fn socket_stream_reader<'scheduler>(
&'scheduler self,
socket: &Self::Socket,
) -> io::Result<
impl SocketStreamReader<Buffer = <Self::Pool as BufferPool>::Buffer>
+ 'scheduler
+ use<'scheduler, Self>,
>
where
Self::Socket: 'static;
/// Construct a reader using the supplied pool for owned chunks. Borrowed reads do not acquire pool storage. Returned chunks retain their pool independently of the reader.
fn socket_stream_reader_with_pool<'scheduler>(
&'scheduler self,
socket: &Self::Socket,
pool: Self::Pool,
) -> io::Result<
impl SocketStreamReader<Buffer = <Self::Pool as BufferPool>::Buffer>
+ 'scheduler
+ use<'scheduler, Self>,
>
where
Self::Socket: 'static;
}