---
title: StreamingBodyHandle
summary: A low-level interface to a streaming HTTP body.
url: https://www.fastly.com/documentation/reference/compute/sdks/rust/fastly/handle/struct.StreamingBodyHandle/
---

**Kind:** Struct  
**Module:** [handle](https://www.fastly.com/documentation/reference/compute/sdks/rust/fastly/handle/)  
**Package:** fastly 0.13.1  
**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/http/body/streaming/handle.rs#28

```rust
pub struct StreamingBodyHandle { /* private fields */ }
```

A low-level interface to a streaming HTTP body.

The interface to this type is very similar to [`BodyHandle`](https://www.fastly.com/documentation/reference/compute/sdks/rust/fastly/handle/struct.BodyHandle/), however it is write-only, and can
only be created as a result of calling
[`ResponseHandle::send_to_client()`](https://www.fastly.com/documentation/reference/compute/sdks/rust/fastly/handle/struct.ResponseHandle/#method-send_to_client) or
[`RequestHandle::send_async_streaming()`](https://www.fastly.com/documentation/reference/compute/sdks/rust/fastly/handle/struct.RequestHandle/#method-send_async_streaming),
or as part of a `CandidateResponse` body transformation.

This type implements [`Write`](https://doc.rust-lang.org/stable/core/io/write/trait.Write.html) to write to the end of a body. Note that these operations are
unbuffered, unlike the same operations on the higher-level [`Body`](https://www.fastly.com/documentation/reference/compute/sdks/rust/fastly/http/body/struct.Body/) type.

A streaming body handle will be automatically aborted if it goes out of scope without calling
[`finish()`](https://www.fastly.com/documentation/reference/compute/sdks/rust/fastly/handle/struct.StreamingBodyHandle/#method-finish).

## Methods

### abandon

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/http/body/streaming/handle.rs#52

```rust
fn abandon(self) -> Result<(), HandleError>
```

Abandon a streaming body handle, indicating an unsuccessful end of the stream.

**Parameters**

- `self`: `Self`

**Returns**

`Result<(), HandleError>`

### append

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/http/body/streaming/handle.rs#120

```rust
fn append(&mut self, other: BodyHandle)
```

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

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

**Parameters**

- `self`: `&mut Self`
- `other`: `BodyHandle`

### as_u32

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/http/body/streaming/handle.rs#80

```rust
unsafe fn as_u32(&self) -> u32
```

Get the underlying representation of the handle.

#### Safety

This should only be used when calling the raw ABI directly, and care should be taken not to
reuse or alias handle values.

**Parameters**

- `self`: `&Self`

**Returns**

`u32`

### finish

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/http/body/streaming/handle.rs#37

```rust
fn finish(self) -> Result<(), HandleError>
```

Finish writing to a streaming body handle.

**Parameters**

- `self`: `Self`

**Returns**

`Result<(), HandleError>`

### from_body_handle

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/http/body/streaming/handle.rs#61

```rust
fn from_body_handle(body_handle: BodyHandle) -> Self
```

Make a streaming body handle from a non-streaming handle.

This should only be used when calling the raw ABI directly, and care should be taken not to
reuse or alias handle values.

**Parameters**

- `body_handle`: `BodyHandle`

**Returns**

`Self`

### into_u32

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/http/body/streaming/handle.rs#97

```rust
fn into_u32(self) -> u32
```

Turn a handle into its representation without closing the underlying resource.

#### Safety

This should only be used when calling the raw ABI directly, and care should be taken not to
reuse or alias handle values.

**Parameters**

- `self`: `Self`

**Returns**

`u32`

## Trait implementations

### impl Debug for StreamingBodyHandle

#### fmt

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/http/body/streaming/handle.rs#24

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

**Parameters**

- `self`: `&Self`
- `f`: `&mut $crate::fmt::Formatter`

**Returns**

`$crate::fmt::Result`

### impl Drop for StreamingBodyHandle

#### drop

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/http/body/streaming/handle.rs#144

```rust
fn drop(&mut self)
```

**Parameters**

- `self`: `&mut Self`

### impl Hash for StreamingBodyHandle

#### hash

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/http/body/streaming/handle.rs#25

```rust
fn hash<__H: Hasher>(&self, state: &mut __H)
```

**Parameters**

- `self`: `&Self`
- `state`: `&mut __H`

### impl PartialEq for StreamingBodyHandle

#### eq

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/http/body/streaming/handle.rs#25

```rust
fn eq(&self, other: &Self) -> bool
```

**Parameters**

- `self`: `&Self`
- `other`: `&Self`

**Returns**

`bool`

### impl Write for StreamingBodyHandle

#### flush

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/http/body/streaming/handle.rs#138

```rust
fn flush(&mut self) -> Result<()>
```

**Parameters**

- `self`: `&mut Self`

**Returns**

`std::io::Result<()>`

#### write

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/http/body/streaming/handle.rs#134

```rust
fn write(&mut self, buf: &[u8]) -> Result<usize>
```

**Parameters**

- `self`: `&mut Self`
- `buf`: `&[u8]`

**Returns**

`std::io::Result<usize>`

## Auto trait implementations

- `Freeze`
- `RefUnwindSafe`
- `Send`
- `Sync`
- `Unpin`
- `UnsafeUnpin`
- `UnwindSafe`

## Blanket implementations

- `Any`
- `Borrow<T>`
- `BorrowMut<T>`
- `Downcast`
- `DowncastSync`
- `Equivalent<K>`
- `ErasedDestructor`
- `From<T>`
- `Into<U>`
- `IntoEither`
- `Same`
- `TryFrom<U>`
- `TryInto<U>`
