pub struct DeviceDescriptor {
pub name: String,
pub viewport: Viewport,
pub user_agent: String,
pub device_scale_factor: f64,
pub is_mobile: bool,
pub touch: TouchMode,
pub has_hover: bool,
}Expand description
Device descriptor with all emulation parameters
Fields§
§name: StringDevice name (e.g., “iPhone 14 Pro”)
viewport: ViewportViewport dimensions
user_agent: StringUser agent string
device_scale_factor: f64Device pixel ratio (e.g., 2.0 for Retina, 3.0 for iPhone)
is_mobile: boolWhether the device is mobile
touch: TouchModeTouch support
has_hover: boolWhether device supports hover
Implementations§
Source§impl DeviceDescriptor
impl DeviceDescriptor
Sourcepub const fn with_viewport(self, viewport: Viewport) -> Self
pub const fn with_viewport(self, viewport: Viewport) -> Self
Set viewport
Sourcepub const fn with_viewport_size(self, width: u32, height: u32) -> Self
pub const fn with_viewport_size(self, width: u32, height: u32) -> Self
Set viewport dimensions
Sourcepub fn with_user_agent(self, ua: impl Into<String>) -> Self
pub fn with_user_agent(self, ua: impl Into<String>) -> Self
Set user agent
Sourcepub const fn with_device_scale_factor(self, factor: f64) -> Self
pub const fn with_device_scale_factor(self, factor: f64) -> Self
Set device scale factor
Sourcepub const fn with_mobile(self, is_mobile: bool) -> Self
pub const fn with_mobile(self, is_mobile: bool) -> Self
Set mobile mode
Sourcepub const fn with_touch(self, touch: TouchMode) -> Self
pub const fn with_touch(self, touch: TouchMode) -> Self
Set touch mode
Sourcepub const fn with_hover(self, has_hover: bool) -> Self
pub const fn with_hover(self, has_hover: bool) -> Self
Set hover support
Trait Implementations§
Source§impl Clone for DeviceDescriptor
impl Clone for DeviceDescriptor
Source§fn clone(&self) -> DeviceDescriptor
fn clone(&self) -> DeviceDescriptor
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DeviceDescriptor
impl Debug for DeviceDescriptor
Source§impl<'de> Deserialize<'de> for DeviceDescriptor
impl<'de> Deserialize<'de> for DeviceDescriptor
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for DeviceDescriptor
impl RefUnwindSafe for DeviceDescriptor
impl Send for DeviceDescriptor
impl Sync for DeviceDescriptor
impl Unpin for DeviceDescriptor
impl UnsafeUnpin for DeviceDescriptor
impl UnwindSafe for DeviceDescriptor
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more