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
impl Eq for ScreenSize
impl StructuralPartialEq for ScreenSize
Auto Trait Implementations§
impl Freeze for ScreenSize
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