Struct hawk::RequestBuilder

source ·
pub struct RequestBuilder<'a>(/* private fields */);

Implementations§

source§

impl<'a> RequestBuilder<'a>

source

pub fn new(method: &'a str, host: &'a str, port: u16, path: &'a str) -> Self

Create a new request with the given method, host, port, and path.

source

pub fn from_url(method: &'a str, url: &'a Url) -> Result<Self>

Create a new request with the host, port, and path determined from the URL.

source

pub fn method(self, method: &'a str) -> Self

Set the request method. This should be a capitalized string.

source

pub fn path(self, path: &'a str) -> Self

Set the URL path for the request.

source

pub fn host(self, host: &'a str) -> Self

Set the URL hostname for the request

source

pub fn port(self, port: u16) -> Self

Set the URL port for the request

source

pub fn url(self, url: &'a Url) -> Result<Self>

Set the hostname, port, and path for the request, from a string URL.

source

pub fn hash<H: Into<Option<&'a [u8]>>>(self, hash: H) -> Self

Set the content hash for the request

source

pub fn ext<S: Into<Option<&'a str>>>(self, ext: S) -> Self

Set the ext Hawk property for the request

source

pub fn app<S: Into<Option<&'a str>>>(self, app: S) -> Self

Set the app Hawk property for the request

source

pub fn dlg<S: Into<Option<&'a str>>>(self, dlg: S) -> Self

Set the dlg Hawk property for the request

source

pub fn request(self) -> Request<'a>

Get the request from this builder

source

pub fn extract_bewit(self, bewit: &mut Option<Bewit<'a>>) -> Result<Self>

Extract the bewit query parameter, if any, from the path, and return it in the output parameter, returning a modified RequestBuilder omitting the bewit=.. query parameter. If no bewit is present, or if an error is returned, the output parameter is reset to None.

The path manipulation is tested to correspond to that preformed by the hueniverse/hawk implementation-specification

Trait Implementations§

source§

impl<'a> Clone for RequestBuilder<'a>

source§

fn clone(&self) -> RequestBuilder<'a>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<'a> Debug for RequestBuilder<'a>

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for RequestBuilder<'a>

§

impl<'a> Send for RequestBuilder<'a>

§

impl<'a> Sync for RequestBuilder<'a>

§

impl<'a> Unpin for RequestBuilder<'a>

§

impl<'a> UnwindSafe for RequestBuilder<'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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.