EmulationOption

Struct EmulationOption 

Source
pub struct EmulationOption { /* private fields */ }
Expand description

Represents the configuration options for emulating a browser and operating system.

The EmulationOption struct allows you to configure various aspects of browser and OS emulation, including the browser version, operating system, and whether to skip certain features like HTTP/2 or headers.

This struct is typically used to build an EmulationProvider that can be applied to HTTP clients for making requests that mimic specific browser and OS configurations.

§Fields

  • emulation: The browser version to emulate. Defaults to Emulation::default().
  • emulation_os: The operating system to emulate. Defaults to EmulationOS::default().
  • skip_http2: Whether to skip HTTP/2 support. Defaults to false.
  • skip_headers: Whether to skip adding default headers. Defaults to false.

§Examples

use rquest_util::{Emulation, EmulationOS, EmulationOption};

let emulation_option = EmulationOption::builder()
    .emulation(Emulation::Chrome134)
    .emulation_os(EmulationOS::MacOS)
    .skip_http2(true)
    .skip_headers(false)
    .build();

// Use `emulation_option` to create an EmulationProvider
let emulation_provider = emulation_option.emulation();

Implementations§

Source§

impl EmulationOption

Source

pub fn builder() -> EmulationOptionBuilder<((), (), (), ())>

Create a builder for building EmulationOption. On the builder, call .emulation(...)(optional), .emulation_os(...)(optional), .skip_http2(...)(optional), .skip_headers(...)(optional) to set the values of the fields. Finally, call .build() to create the instance of EmulationOption.

Trait Implementations§

Source§

impl Default for EmulationOption

Source§

fn default() -> EmulationOption

Returns the “default value” for a type. Read more
Source§

impl EmulationProviderFactory for EmulationOption

Source§

fn emulation(self) -> EmulationProvider

Provides an EmulationProvider instance.

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, 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> ErasedDestructor for T
where T: 'static,