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: u32Device screen Width
height: u32Device screen size
device_scale_factor: Option<f64>Device scale factor
emulating_mobile: boolEmulating Mobile?
is_landscape: boolUse landscape mode instead of portrait.
has_touch: boolTouch 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§
Source§impl<'de> Deserialize<'de> for Viewport
impl<'de> Deserialize<'de> for Viewport
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
impl Copy for Viewport
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 UnsafeUnpin 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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