Skip to main content

WrapperTermRequestBuilder

Struct WrapperTermRequestBuilder 

Source
pub struct WrapperTermRequestBuilder<'a> { /* private fields */ }
Expand description

A structure that represents a request to be “built.” This allows you to override any settings set by the original wrapper for any requests made under the soon-to-be-built requester.

Using this builder, you can either build

  • the general requester, which is your main “gateway” to a majority of the API.
  • the raw requester, which gives you the ability to manually process some API responses on your own.

Implementations§

Source§

impl<'a> WrapperTermRequestBuilder<'a>

Source

pub fn new_request(wrapper_data: &'a WebRegWrapperData, term: &'a str) -> Self

Initializes a new builder with the settings derived from the wrapper.

§Parameters
  • wrapper: The wrapper.
§Returns

The builder.

Source

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

Overrides the cookies for any requests made under this soon-to-be requester.

If you plan on overriding cookies for this particular request, you should ensure requests are being closed on completion (call should_close_after_request for the builder).

§Parameters
  • cookies: The cookies to use. This will not override the cookies for the wrapper, just this request.
§Returns

The builder.

§Panic

This function will only panic if you configured the wrapper instance so that it does not close the connection after a request is done.

For some context, when creating the wrapper instance, you have the option of setting whether the connection is closed after a request is done (via the builder’s should_close_after_request function). If you never called this function, or you used the default constructor to create the wrapper, or you explicitly set this value to false, then the wrapper instance will not close the connection after a request is done and thus will panic when this function is called.

Source

pub fn override_client(self, client: &'a Client) -> Self

Overrides the client for any requests made under this soon-to-be requester.

§Parameters
  • client: The client to use. This will not override the client for the wrapper, just this request.
§Returns

The builder.

Source

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

Overrides the user agent for any requests made under this soon-to-be requester.

§Parameters
  • user_agent: The user agent to use. This will not override the user agent for the wrapper, just this request.
§Returns

The builder.

Source

pub fn override_timeout(self, duration: Duration) -> Self

Overrides the timeout for any requests made under this soon-to-be requester.

§Parameters
  • duration: The timeout to use. This will not override the timeout for the wrapper, just this request.
§Returns

The builder.

Source

pub fn raw(self) -> WrapperTermRawRequest<'a>

Builds the requester that can be used to generally obtain raw responses from WebReg.

Note that you should use this requester if you want to manually parse the responses from WebReg yourself. The raw requester will handle some error handling from WebReg.

It is recommended that you build the parsed requester instead, as this gives you significantly more access to the overall API. The parsed requester, as the name implies, also handles the parsing of the raw requests for you.

§Returns

The raw requester.

Source

pub fn parsed(self) -> WrapperTermRequest<'a>

Builds the requester that can be used to make many different calls (GET, POST) to WebReg.

§Returns

The parsed requester.

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