[][src]Struct fastly::handle::StreamingBodyHandle

#[repr(transparent)]pub struct StreamingBodyHandle { /* fields omitted */ }

A low-level interface to a streaming HTTP body.

The interface to this type is very similar to BodyHandle, however it is write-only, and can only be created as a result of calling ResponseHandle::send_to_client() or RequestHandle::send_async_streaming().

This type implements Write to write to the end of a body. Note that these operations are unbuffered, unlike the same operations on the higher-level Body type.

A streaming body will be automatically closed when it goes out of scope, or when it is passed to drop().

Implementations

impl StreamingBodyHandle[src]

pub fn append(&mut self, other: BodyHandle)[src]

Append another body onto the end of this body.

This operation is performed in amortized constant time, and so should always be preferred to reading an entire body and then writing the same contents to another body.

The other body will no longer be valid after this call.

Examples

let mut streaming_body = response_handle.stream_to_client(BodyHandle::new());
streaming_body.append(other_body);

pub fn write_bytes(&mut self, bytes: &[u8]) -> usize[src]

Write a slice of bytes to the end of this streaming body, and the number of bytes written.

Examples

let mut streaming_body = response_handle.stream_to_client(BodyHandle::new());
streaming_body.write_bytes(&[0, 1, 2, 3]);

pub fn write_str(&mut self, string: &str) -> usize[src]

Write a string slice to the end of this streaming body, and the number of bytes written.

Examples

let mut streaming_body = response_handle.stream_to_client(BodyHandle::new());
streaming_body.write_str("woof woof");

Trait Implementations

impl Debug for StreamingBodyHandle[src]

impl Drop for StreamingBodyHandle[src]

impl Eq for StreamingBodyHandle[src]

impl From<StreamingBodyHandle> for StreamingBody[src]

impl Hash for StreamingBodyHandle[src]

impl PartialEq<StreamingBodyHandle> for StreamingBodyHandle[src]

impl StructuralEq for StreamingBodyHandle[src]

impl StructuralPartialEq for StreamingBodyHandle[src]

impl Write for StreamingBodyHandle[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.