pub struct ResponseSink { /* private fields */ }server-core only.Expand description
Sends the parts of a ResponseStream.
Sending never waits for the client, so a slow client can’t hold the producer’s resources. The parts it has not read yet stay in memory, up to the response size limit.
Implementations§
Source§impl ResponseSink
impl ResponseSink
Sourcepub fn send(&self, part: Bytes) -> Result<(), SendError<Bytes>>
pub fn send(&self, part: Bytes) -> Result<(), SendError<Bytes>>
Queues the next part of the result.
Fails once the response was dropped or part would exceed the response size limit, so the
producer can stop.
Sourcepub fn send_json<T>(&self, prefix: &[u8], value: &T) -> Result<(), Error>
pub fn send_json<T>(&self, prefix: &[u8], value: &T) -> Result<(), Error>
Serializes value after prefix and queues it as the next part.
Serialization stops once the part exceeds the response size limit, so an oversized value is
never written in full. Fails with an I/O error once the response was dropped or the part
would exceed the limit, so the producer can stop, and with a serialization error if value
can’t be serialized.
Trait Implementations§
Source§impl Clone for ResponseSink
impl Clone for ResponseSink
Source§fn clone(&self) -> ResponseSink
fn clone(&self) -> ResponseSink
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Forget for ResponseSink
impl Freeze for ResponseSink
impl Move for ResponseSink
impl RefUnwindSafe for ResponseSink
impl Send for ResponseSink
impl Sync for ResponseSink
impl Unpin for ResponseSink
impl UnsafeUnpin for ResponseSink
impl UnwindSafe for ResponseSink
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 16 bytes