Struct varnish::vcl::http::HTTP

source ·
pub struct HTTP<'a> {
    pub raw: &'a mut http,
}
Expand description

HTTP headers of an object

Fields§

§raw: &'a mut http

Implementations§

source§

impl<'a> HTTP<'a>

source

pub fn new(p: *mut http) -> Option<Self>

Wrap a raw pointer into an object we can use.

source

pub fn set_header(&mut self, name: &str, value: &str) -> Result<()>

Append a new header using name and value. This can fail if we run out of internal slots to store the new header

source

pub fn unset_header(&mut self, name: &str)

source

pub fn method(&self) -> Option<&str>

Method of an HTTP request, None for a response

source

pub fn url(&self) -> Option<&str>

URL of an HTTP request, None for a response

source

pub fn proto(&self) -> Option<&str>

Protocol of an object

It should exist for both requests and responses, but the Option is maintained for consistency.

source

pub fn set_proto(&mut self, value: &str) -> Result<()>

Set prototype

source

pub fn status(&self) -> Option<&str>

Response status, None for a request

source

pub fn set_status(&mut self, status: u16)

Set the response status, it will also set the reason

source

pub fn reason(&self) -> Option<&str>

Response reason, None for a request

source

pub fn set_reason(&mut self, value: &str) -> Result<()>

Set reason

source

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

Returns the value of a header based on its name

The header names are compared in a case-insensitive manner

Trait Implementations§

source§

impl<'a> IntoIterator for &'a HTTP<'a>

§

type Item = (&'a str, &'a str)

The type of the elements being iterated over.
§

type IntoIter = HTTPIter<'a>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl<'a> IntoIterator for &'a mut HTTP<'a>

§

type Item = (&'a str, &'a str)

The type of the elements being iterated over.
§

type IntoIter = HTTPIter<'a>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for HTTP<'a>

§

impl<'a> RefUnwindSafe for HTTP<'a>

§

impl<'a> !Send for HTTP<'a>

§

impl<'a> !Sync for HTTP<'a>

§

impl<'a> Unpin for HTTP<'a>

§

impl<'a> !UnwindSafe for HTTP<'a>

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>,

§

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>,

§

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.