pub struct StreamHandle {
pub stream_id: [u8; 16],
pub mode: StreamMode,
/* private fields */
}Fields§
§stream_id: [u8; 16]§mode: StreamModeImplementations§
Source§impl StreamHandle
impl StreamHandle
Sourcepub async fn open(
session: &mut Session,
procedure: &str,
realm: [u8; 32],
mode: StreamMode,
args: Value,
deadline_ms: i128,
identity: &KeyPair,
) -> Result<Self, OpenError>
pub async fn open( session: &mut Session, procedure: &str, realm: [u8; 32], mode: StreamMode, args: Value, deadline_ms: i128, identity: &KeyPair, ) -> Result<Self, OpenError>
Sourcepub async fn accept(
session: &mut Session,
timeout: Duration,
) -> Result<(Self, StreamOpenInfo), AcceptError>
pub async fn accept( session: &mut Session, timeout: Duration, ) -> Result<(Self, StreamOpenInfo), AcceptError>
Provider role: block for the next inbound STREAM_OPEN on
session’s connection, bounded by timeout. Only ever succeeds
after Session::advertise
has registered at least one procedure — otherwise the station has
nothing to route here. Returns the ready-to-use handle alongside
the parsed frame::StreamOpenInfo (check its procedure if
this session advertised more than one).
Sourcepub async fn send_reply(
&mut self,
payload: Value,
identity: &KeyPair,
) -> Result<(), SendFrameError>
pub async fn send_reply( &mut self, payload: Value, identity: &KeyPair, ) -> Result<(), SendFrameError>
Provider role: send the terminal STREAM_REPLY a client_stream/
bidi caller’s own await_reply is waiting
on, once this side has fully consumed and verified whatever the
caller streamed.
Sourcepub async fn send_data(
&mut self,
encoding: StreamEncoding,
body: Value,
identity: &KeyPair,
) -> Result<(), SendFrameError>
pub async fn send_data( &mut self, encoding: StreamEncoding, body: Value, identity: &KeyPair, ) -> Result<(), SendFrameError>
Send one chunk. seq is tracked internally, starting at 0 and
incrementing per call — matches the reference’s seq_out counter
(a sanity/debugging signal, not used for reordering: frames
arrive in order on a single QUIC stream by construction).
Sourcepub async fn close_send(
&mut self,
identity: &KeyPair,
) -> Result<(), SendFrameError>
pub async fn close_send( &mut self, identity: &KeyPair, ) -> Result<(), SendFrameError>
Half-close: signal this side is done sending. For
client_stream/bidi modes, follow with
await_reply.
Sourcepub async fn recv(
&mut self,
timeout: Duration,
) -> Result<StreamItem, RecvStreamError>
pub async fn recv( &mut self, timeout: Duration, ) -> Result<StreamItem, RecvStreamError>
Receive the next chunk or end-of-stream, bounded by timeout.
Sourcepub async fn await_reply(
&mut self,
timeout: Duration,
) -> Result<(Value, [u8; 32]), RecvStreamError>
pub async fn await_reply( &mut self, timeout: Duration, ) -> Result<(Value, [u8; 32]), RecvStreamError>
Block for the provider’s terminal STREAM_REPLY (client_stream/
bidi modes only) — call after close_send.
Sourcepub async fn abort(
self,
code: impl Into<String>,
message: impl Into<String>,
identity: &KeyPair,
)
pub async fn abort( self, code: impl Into<String>, message: impl Into<String>, identity: &KeyPair, )
Non-normal termination: explicitly tell the peer this stream is
aborting, per §13.1 point 4 — the only signal the peer gets to
distinguish a cancellation/failure from a dropped connection.
Best-effort, like Session::close’s
GOODBYE — consumes self so the handle can’t be used again after
aborting.