Struct spider::features::chrome_common::Viewport
source · 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
View port handling for chrome.
Fields§
§width: u32
Device screen Width
height: u32
Device screen size
device_scale_factor: Option<f64>
Device scale factor
emulating_mobile: bool
Emulating Mobile?
is_landscape: bool
Use landscape mode instead of portrait.
has_touch: bool
Touch screen device?
Implementations§
source§impl Viewport
impl Viewport
sourcepub fn new(width: u32, height: u32) -> Self
pub fn new(width: u32, height: u32) -> Self
Create a new viewport layout for chrome passing in the width.
sourcepub fn set_mobile(&mut self, emulating_mobile: bool)
pub fn set_mobile(&mut self, emulating_mobile: bool)
Determine if the layout is a mobile device or not to emulate.
sourcepub fn set_landscape(&mut self, is_landscape: bool)
pub fn set_landscape(&mut self, is_landscape: bool)
Determine if the layout is in landscrape view or not to emulate.
sourcepub fn set_touch(&mut self, has_touch: bool)
pub fn set_touch(&mut self, has_touch: bool)
Determine if the device is a touch screen or not to emulate.
sourcepub fn set_scale_factor(&mut self, device_scale_factor: Option<f64>)
pub fn set_scale_factor(&mut self, device_scale_factor: Option<f64>)
The scale factor for the screen layout.
Trait Implementations§
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