Struct BodyChunk

Source
pub struct BodyChunk {
    pub received: bool,
    pub end_of_stream: bool,
    pub size: u64,
    pub start: u64,
    pub content: Vec<u8>,
}
Expand description

The first chunk of an HTTP body.

Bulwark does not send the entire body to the guest plugin environment. This limitation limits the impact of copying a large number of bytes from the host into guest VMs. A full body copy would be required for each plugin for every request or response otherwise.

This has consequences for any plugin that wants to parse the body it receives. Some data formats like JSON may be significantly more difficult to work with if only partially received, and streaming parsers which may be more tolerant to trunctation are recommended in such cases. There will be some situations where this limitation prevents useful parsing entirely and plugins may need to make use of the unknown result value to express this.

Fields§

§received: bool§end_of_stream: bool§size: u64§start: u64§content: Vec<u8>

Trait Implementations§

Source§

impl From<&str> for BodyChunk

Source§

fn from(content: &str) -> Self

Converts to this type from the input type.
Source§

impl From<String> for BodyChunk

Source§

fn from(content: String) -> Self

Converts to this type from the input type.
Source§

impl From<Vec<u8>> for BodyChunk

Source§

fn from(content: Vec<u8>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

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.
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T