# Enum actix_web::Binary[−][src]

    pub enum Binary {
        Bytes(Bytes),
        Slice(&'static [u8]),
        SharedVec(Arc<Vec<u8>>),
        // some variants omitted
    }

Represents various types of binary body. `Content-Length` header is set to length of the body.

## Variants

`Bytes(Bytes)`

Bytes body

`Slice(&'static [u8])`

Static slice

`SharedVec(Arc<Vec<u8>>)`

Shared vec body

## Methods

###

`impl Binary`

[src]

####

`pub fn is_empty(&self) -> bool`

[src]

Returns `true` if body is empty

####

`pub fn len(&self) -> usize`

[src]

Length of body in bytes

####

`pub fn from_slice(s: &[u8]) -> Binary`

[src]

Create binary body from slice

####

`pub fn take(&mut self) -> Bytes`

[src]

Convert Binary to a Bytes instance

## Trait Implementations

###

`impl Debug for Binary`

[src]

####

`fn fmt(&self, f: &mut Formatter) -> Result`

[src]

Formats the value using the given formatter. Read more

###

`impl PartialEq for Binary`

[src]

####

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

[src]

This method tests for `self` and `other` values to be equal, and is used by `==`. Read more

####

`fn ne(&self, other: &Binary) -> bool`

[src]

This method tests for `!=`.

###

`impl Clone for Binary`

[src]

####

`fn clone(&self) -> Binary`

[src]

Returns a copy of the value. Read more

####

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

1.0.0
[src]

Performs copy-assignment from `source`. Read more

###

`impl Into<Bytes> for Binary`

[src]

####

`fn into(self) -> Bytes`

[src]

Performs the conversion.

###

`impl From<&'static str> for Binary`

[src]

####

`fn from(s: &'static str) -> Binary`

[src]

Performs the conversion.

###

`impl From<&'static [u8]> for Binary`

[src]

####

`fn from(s: &'static [u8]) -> Binary`

[src]

Performs the conversion.

###

`impl From<Vec<u8>> for Binary`

[src]

####

`fn from(vec: Vec<u8>) -> Binary`

[src]

Performs the conversion.

###

`impl From<String> for Binary`

[src]

####

`fn from(s: String) -> Binary`

[src]

Performs the conversion.

###

`impl<'a> From<&'a String> for Binary`

[src]

####

`fn from(s: &'a String) -> Binary`

[src]

Performs the conversion.

###

`impl From<Bytes> for Binary`

[src]

####

`fn from(s: Bytes) -> Binary`

[src]

Performs the conversion.

###

`impl From<BytesMut> for Binary`

[src]

####

`fn from(s: BytesMut) -> Binary`

[src]

Performs the conversion.

###

`impl From<Arc<String>> for Binary`

[src]

####

`fn from(body: Arc<String>) -> Binary`

[src]

Performs the conversion.

###

`impl<'a> From<&'a Arc<String>> for Binary`

[src]

####

`fn from(body: &'a Arc<String>) -> Binary`

[src]

Performs the conversion.

###

`impl From<Arc<Vec<u8>>> for Binary`

[src]

####

`fn from(body: Arc<Vec<u8>>) -> Binary`

[src]

Performs the conversion.

###

`impl<'a> From<&'a Arc<Vec<u8>>> for Binary`

[src]

####

`fn from(body: &'a Arc<Vec<u8>>) -> Binary`

[src]

Performs the conversion.

###

`impl AsRef<[u8]> for Binary`

[src]

####
ⓘImportant traits for &'a [u8]

### Important traits for &'a [u8]

`impl<'a> Read for &'a [u8]impl<'a> Write for &'a mut [u8]`

`fn as_ref(&self) -> &[u8]`

[src]

Performs the conversion.

###

`impl Responder for Binary`

[src]

#### `type Item = HttpResponse`

The associated item which can be returned.

#### `type Error = Error`

The associated error which can be returned.

####

`fn respond_to<S>(self, req: &HttpRequest<S>) -> Result<HttpResponse, Error>`

[src]

Convert itself to `AsyncResult` or `Error`.

## Auto Trait Implementations

###

`impl Send for Binary`

###

`impl Sync for Binary`

# Help

## Keyboard Shortcuts

`?`
  Show this help dialog
`S`
  Focus the search field
`↑`
  Move up in search results
`↓`
  Move down in search results
`↹`
  Switch tab
`⏎`
  Go to active search result
`+`
  Expand all sections
`-`
  Collapse all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)

Search multiple things at once by splitting your query with comma (e.g. `str,u8` or `String,struct:Vec,test`)