Struct h2::proto::streams::streams::StreamRef

source ·
pub(crate) struct StreamRef<B> {
    opaque: OpaqueStreamRef,
    send_buffer: Arc<SendBuffer<B>>,
}
Expand description

Reference to the stream state

Fields§

§opaque: OpaqueStreamRef§send_buffer: Arc<SendBuffer<B>>

Implementations§

source§

impl<B> StreamRef<B>

source

pub fn send_data(&mut self, data: B, end_stream: bool) -> Result<(), UserError>where B: Buf,

source

pub fn send_trailers(&mut self, trailers: HeaderMap) -> Result<(), UserError>

source

pub fn send_reset(&mut self, reason: Reason)

source

pub fn send_response( &mut self, response: Response<()>, end_of_stream: bool ) -> Result<(), UserError>

source

pub fn send_push_promise( &mut self, request: Request<()> ) -> Result<StreamRef<B>, UserError>

source

pub fn take_request(&self) -> Request<()>

Called by the server after the stream is accepted. Given that clients initialize streams by sending HEADERS, the request will always be available.

Panics

This function panics if the request isn’t present.

source

pub fn is_pending_open(&self) -> bool

Called by a client to see if the current stream is pending open

source

pub fn reserve_capacity(&mut self, capacity: u32)

Request capacity to send data

source

pub fn capacity(&self) -> u32

Returns the stream’s current send capacity.

source

pub fn poll_capacity( &mut self, cx: &Context<'_> ) -> Poll<Option<Result<u32, UserError>>>

Request to be notified when the stream’s capacity increases

source

pub(crate) fn poll_reset( &mut self, cx: &Context<'_>, mode: PollReset ) -> Poll<Result<Reason, Error>>

Request to be notified for if a RST_STREAM is received for this stream.

source

pub fn clone_to_opaque(&self) -> OpaqueStreamRef

source

pub fn stream_id(&self) -> StreamId

Trait Implementations§

source§

impl<B> Clone for StreamRef<B>

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<B: Debug> Debug for StreamRef<B>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<B> RefUnwindSafe for StreamRef<B>

§

impl<B> Send for StreamRef<B>where B: Send,

§

impl<B> Sync for StreamRef<B>where B: Send,

§

impl<B> Unpin for StreamRef<B>

§

impl<B> UnwindSafe for StreamRef<B>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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