Skip to main content

Data

Struct Data 

Source
pub struct Data { /* private fields */ }
Expand description

A buffer of bytes, which may be inline or on the host.

Some bulk data processing Functions may choose to pass data straight from a request or response body to another request or response body. To improve performance on these kinds of Functions, Data avoids copying the buffer into your function’s memory.

Implementations§

Source§

impl Data

Source

pub fn into_bytes(self) -> Vec<u8>

Turn the Data into a plain Vec<u8>.

If the data is buffered on the host, this will read the buffer completely into your function’s memory. You should use this with caution!

For small buffers, this is inconsequential. For larger buffers, this may cause your function to run out of memory or to run slowly.

Trait Implementations§

Source§

impl Debug for Data

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Encode for Data

Source§

type Error = Infallible

The error type returned when encoding fails.
Source§

fn try_serialize(self) -> Result<Data, <Data as Encode>::Error>

Convert the payload to a vector of bytes
Source§

impl Extract for Data

Source§

type Error = Infallible

The error type returned when extraction fails.
Source§

fn extract(payload: Data) -> Result<Data, <Data as Extract>::Error>

Convert from a payload to a value
Source§

impl From<&[u8]> for Data

Source§

fn from(value: &[u8]) -> Data

Converts to this type from the input type.
Source§

impl From<&str> for Data

Source§

fn from(value: &str) -> Data

Converts to this type from the input type.
Source§

impl From<Data> for Data

Source§

fn from(value: Data) -> Data

Converts to this type from the input type.
Source§

impl From<String> for Data

Source§

fn from(value: String) -> Data

Converts to this type from the input type.
Source§

impl From<Vec<u8>> for Data

Source§

fn from(value: Vec<u8>) -> Data

Converts to this type from the input type.

Auto Trait Implementations§

§

impl !Freeze for Data

§

impl RefUnwindSafe for Data

§

impl Send for Data

§

impl Sync for Data

§

impl Unpin for Data

§

impl UnsafeUnpin for Data

§

impl UnwindSafe for Data

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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, U> Into<U> for T
where 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.