pub struct Viewport {
pub width: u32,
pub height: u32,
pub device_scale_factor: Option<f64>,
pub emulating_mobile: bool,
pub is_landscape: bool,
pub has_touch: bool,
}Expand description
Page viewport configuration used when emulating screen metrics.
Width/height are in CSS pixels. Optional fields allow tuning device pixel ratio, mobile emulation, orientation, and touch support.
Fields§
§width: u32CSS pixel width of the viewport (layout viewport, not device pixels).
height: u32CSS pixel height of the viewport.
device_scale_factor: Option<f64>Device pixel ratio (DPR). If None, the browser default is used.
Common values: 1.0 for standard displays, 2.0 for “Retina”-like.
emulating_mobile: boolSimulate a mobile device (affects UA hints/metrics in some engines).
Set to true to enable mobile-specific layout behavior.
is_landscape: boolTreat the viewport as landscape (true) or portrait (false).
has_touch: boolAdvertise touch support (affects input/event capability).
Set to true to enable touch-enabled emulation.
Trait Implementations§
impl StructuralPartialEq for Viewport
Auto Trait Implementations§
impl Freeze for Viewport
impl RefUnwindSafe for Viewport
impl Send for Viewport
impl Sync for Viewport
impl Unpin for Viewport
impl UnwindSafe for Viewport
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