Skip to main content

StreamHandle

Struct StreamHandle 

Source
pub struct StreamHandle {
    pub stream_id: [u8; 16],
    pub mode: StreamMode,
    /* private fields */
}

Fields§

§stream_id: [u8; 16]§mode: StreamMode

Implementations§

Source§

impl StreamHandle

Source

pub async fn open( session: &mut Session, procedure: &str, realm: [u8; 32], mode: StreamMode, args: Value, deadline_ms: i128, identity: &KeyPair, ) -> Result<Self, OpenError>

Open a dedicated stream on session’s connection and send a signed STREAM_OPEN. Fire-and-forget at the wire level — no reply is expected here; drive recv (for server_stream/bidi) or send_data (for client_stream/bidi) next, depending on mode.

Source

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).

Source

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.

Source

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).

Source

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.

Source

pub async fn recv( &mut self, timeout: Duration, ) -> Result<StreamItem, RecvStreamError>

Receive the next chunk or end-of-stream, bounded by timeout.

Source

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.

Source

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.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more