Struct emscripten_functions::emscripten::ScreenSize
source · pub struct ScreenSize {
pub width: c_int,
pub height: c_int,
}
Expand description
The result of the get_screen_size
function.
Implements Display
as {width}x{height}
.
Useful for writing the screen size easily, e.g. using .to_string()
in your app.
Examples
let screen_size = get_screen_size();
// This should display something like: "Your screen size is 800x600"
println!("Your screen size is {}", screen_size);
let an_old_size = ScreenSize {
width: 800,
height: 600
};
if an_old_size == screen_size {
println!("Wow, you have the 'old' size of 800x600");
}
println!("You have {} pixels", screen_size.width * screen_size.height);
Fields§
§width: c_int
§height: c_int
Trait Implementations§
source§impl Clone for ScreenSize
impl Clone for ScreenSize
source§fn clone(&self) -> ScreenSize
fn clone(&self) -> ScreenSize
Returns a copy 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 Debug for ScreenSize
impl Debug for ScreenSize
source§impl Display for ScreenSize
impl Display for ScreenSize
source§impl PartialEq for ScreenSize
impl PartialEq for ScreenSize
source§fn eq(&self, other: &ScreenSize) -> bool
fn eq(&self, other: &ScreenSize) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl Eq for ScreenSize
impl StructuralEq for ScreenSize
impl StructuralPartialEq for ScreenSize
Auto Trait Implementations§
impl RefUnwindSafe for ScreenSize
impl Send for ScreenSize
impl Sync for ScreenSize
impl Unpin for ScreenSize
impl UnwindSafe for ScreenSize
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