EventData

Struct EventData 

Source
pub struct EventData<'a, S: Event> { /* private fields */ }
Expand description

Manages the access to the data of each event.

Implementations§

Source§

impl EventData<'_, RequestHeaders>

Source

pub fn method(&self) -> String

Source

pub fn scheme(&self) -> String

Source

pub fn authority(&self) -> String

Source

pub fn path(&self) -> String

Source§

impl EventData<'_, ResponseHeaders>

Source

pub fn status_code(&self) -> u32

Source§

impl EventData<'_, RequestTrailers>

Source

pub fn header(&self, name: &str) -> Option<String>

Source

pub fn headers(&self) -> Vec<(String, String)>

Source§

impl<S> EventData<'_, S>
where S: BodyEvent,

Source

pub fn offset(&self) -> usize

Source

pub fn chunk_size(&self) -> usize

Source

pub fn read_body(&self, offset: usize, max_size: usize) -> Vec<u8>

Source

pub fn read_chunk(&self) -> Vec<u8>

Source

pub fn read_payload(&self) -> Vec<u8>

Trait Implementations§

Source§

impl HeadersAccessor for EventData<'_, RequestHeaders>

Source§

fn header(&self, name: &str) -> Option<String>

Return the first header value for the given name. Known Limitations: The header value will be converted to an utf-8 String If the bytes correspond to a non utf-8 string they will be parsed as an iso_8859_1 encoding.
Source§

fn headers(&self) -> Vec<(String, String)>

Returns a copy of all the headers. Known Limitations: The header values will be converted to utf-8 Strings If the bytes correspond to a non utf-8 string they will be parsed as an iso_8859_1 encoding.
Source§

fn add_header(&self, name: &str, value: &str)

Adds a new value of the header to the event.
Source§

fn set_header(&self, name: &str, value: &str)

Replaces value of the header to the event.
Source§

fn set_headers(&self, headers: Vec<(&str, &str)>)

Replaces all the headers of the event.
Source§

fn remove_header(&self, name: &str)

Removes the specified header.
Source§

impl HeadersAccessor for EventData<'_, ResponseHeaders>

Source§

fn header(&self, name: &str) -> Option<String>

Return the first header value for the given name. Known Limitations: The header value will be converted to an utf-8 String If the bytes correspond to a non utf-8 string they will be parsed as an iso_8859_1 encoding.
Source§

fn headers(&self) -> Vec<(String, String)>

Returns a copy of all the headers. Known Limitations: The header values will be converted to utf-8 Strings If the bytes correspond to a non utf-8 string they will be parsed as an iso_8859_1 encoding.
Source§

fn add_header(&self, name: &str, value: &str)

Adds a new value of the header to the event.
Source§

fn set_header(&self, name: &str, value: &str)

Replaces value of the header to the event.
Source§

fn set_headers(&self, headers: Vec<(&str, &str)>)

Replaces all the headers of the event.
Source§

fn remove_header(&self, name: &str)

Removes the specified header.

Auto Trait Implementations§

§

impl<'a, S> Freeze for EventData<'a, S>
where S: Freeze,

§

impl<'a, S> !RefUnwindSafe for EventData<'a, S>

§

impl<'a, S> !Send for EventData<'a, S>

§

impl<'a, S> !Sync for EventData<'a, S>

§

impl<'a, S> Unpin for EventData<'a, S>

§

impl<'a, S> !UnwindSafe for EventData<'a, S>

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<C, T> Extract<T> for C
where T: FromContext<C>,

Source§

type Error = <T as FromContext<C>>::Error

Source§

fn extract(&self) -> Result<T, <C as Extract<T>>::Error>

Source§

fn extract_always(&self) -> T
where Self: Extract<T, Error = Infallible>,

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.