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 toEmulation::default()
.emulation_os
: The operating system to emulate. Defaults toEmulationOS::default()
.skip_http2
: Whether to skip HTTP/2 support. Defaults tofalse
.skip_headers
: Whether to skip adding default headers. Defaults tofalse
.
§Examples
use wreq_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
impl EmulationOption
Sourcepub fn builder() -> EmulationOptionBuilder<((), (), (), ())>
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 Clone for EmulationOption
impl Clone for EmulationOption
Source§fn clone(&self) -> EmulationOption
fn clone(&self) -> EmulationOption
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Default for EmulationOption
impl Default for EmulationOption
Source§fn default() -> EmulationOption
fn default() -> EmulationOption
Returns the “default value” for a type. Read more
Source§impl EmulationProviderFactory for EmulationOption
impl EmulationProviderFactory for EmulationOption
Source§fn emulation(self) -> EmulationProvider
fn emulation(self) -> EmulationProvider
Provides an
EmulationProvider
instance.Auto Trait Implementations§
impl Freeze for EmulationOption
impl RefUnwindSafe for EmulationOption
impl Send for EmulationOption
impl Sync for EmulationOption
impl Unpin for EmulationOption
impl UnwindSafe for EmulationOption
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more