Skip to main content

HeaderMut

Struct HeaderMut 

Source
pub struct HeaderMut<'a> { /* private fields */ }
Available on crate feature api only.

Implementations§

Source§

impl<'a> HeaderMut<'a>

Source

pub fn new(header: &'a mut HeaderMap) -> Self

Source

pub fn header(&mut self, key: HeaderName, value: HeaderValue) -> &mut Self

Source

pub fn header_static( &mut self, key: HeaderName, value: &'static str, ) -> &mut Self

Source

pub fn header_static_sensitive( &mut self, key: HeaderName, value: &'static str, ) -> &mut Self

Source

pub fn header_str( &mut self, key: HeaderName, value: &str, ) -> Result<&mut Self, Error>

Source

pub fn header_str_sensitive( &mut self, key: HeaderName, value: &str, ) -> Result<&mut Self, Error>

Source

pub fn append(&mut self, key: HeaderName, value: HeaderValue) -> &mut Self

Source

pub fn extend(&mut self, headers: HeaderMap) -> &mut Self

Source

pub fn is_empty(&self) -> bool

Source

pub fn client_id(&mut self, id: &str) -> Result<&mut Self, Error>

Client-Id: id

Source

pub fn user_agent(&mut self, agent: &str) -> Result<&mut Self, Error>

User-Agent: agent

Source

pub fn cache_control_no_cache(&mut self) -> &mut Self

Cache-Control: no-cache

Source

pub fn cache_control(&mut self, value: &str) -> Result<&mut Self, Error>

Cache-Control: value

Source

pub fn api_key(&mut self, key: &str) -> Result<&mut Self, Error>

X-API-Key: key

Source

pub fn request_id(&mut self, id: &str) -> Result<&mut Self, Error>

X-Request-ID: id

Source

pub fn origin(&mut self, origin: &str) -> Result<&mut Self, Error>

Origin: origin

Source

pub fn referer(&mut self, referer: &str) -> Result<&mut Self, Error>

Referer: referer

Source

pub fn cors_allow_all(&mut self) -> &mut Self

Access-Control-Allow-Origin: *

Source

pub fn cors_allow_origin(&mut self, origin: &str) -> Result<&mut Self, Error>

Access-Control-Allow-Origin: origin

Source

pub fn cors_allow_methods_standard(&mut self) -> &mut Self

Access-Control-Allow-Methods: GET, POST, PUT, DELETE

Source

pub fn cors_allow_headers_standard(&mut self) -> &mut Self

Access-Control-Allow-Headers: Content-Type, Authorization

Source

pub fn connection_keep_alive(&mut self) -> &mut Self

Connection: keep-alive

Source

pub fn connection_close(&mut self) -> &mut Self

Connection: close

Source

pub fn content_length(&mut self, length: u64) -> &mut Self

Content-Length: length

Source

pub fn json_api(&mut self) -> &mut Self

Accept: application/json, Content-Type: application/json

Source§

impl<'a> HeaderMut<'a>

Source

pub fn accept_json(&mut self) -> &mut Self

ACCEPT: application/json

Source

pub fn accept_html(&mut self) -> &mut Self

ACCEPT: text/html

Source

pub fn accept_text(&mut self) -> &mut Self

ACCEPT: text/plain

Source

pub fn accept_any(&mut self) -> &mut Self

ACCEPT: /

Source

pub fn accept_mulity(&mut self, items: &[&str]) -> Result<&mut Self, Error>

ACCEPT: multi items

Source

pub fn accept_encoding_standard(&mut self) -> &mut Self

Accept-Encoding: gzip, deflate, br

Source

pub fn accept_language_en(&mut self) -> &mut Self

Accept-Language: en-US, en;q=0.9

Source

pub fn accept_language(&mut self, lang: &str) -> Result<&mut Self, Error>

Accept-Language: lang

Source§

impl<'a> HeaderMut<'a>

Source

pub fn content_type_formencoded(&mut self) -> &mut Self

CONTENT-TYPE: application/x-www-form-urlencoded

Source

pub fn content_type_json(&mut self) -> &mut Self

CONTENT-TYPE: application/json

Source

pub fn content_type_text(&mut self) -> &mut Self

CONTENT-TYPE: text/plain

Source

pub fn content_type_html(&mut self) -> &mut Self

CONTENT-TYPE: text/html

Source

pub fn content_type_multipart(&mut self) -> &mut Self

CONTENT-TYPE: multipart/form-data

Source§

impl<'a> HeaderMut<'a>

Source

pub fn authorization(&mut self, auth: AuthScheme<'_>) -> &mut Self

Authorization: type credentials

Source

pub fn basic_auth(&mut self, username: &str, password: &str) -> &mut Self

Source

pub fn bearer_token(&mut self, token: &str) -> &mut Self

Auto Trait Implementations§

§

impl<'a> Freeze for HeaderMut<'a>

§

impl<'a> RefUnwindSafe for HeaderMut<'a>

§

impl<'a> Send for HeaderMut<'a>

§

impl<'a> Sync for HeaderMut<'a>

§

impl<'a> Unpin for HeaderMut<'a>

§

impl<'a> !UnwindSafe for HeaderMut<'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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more