pub struct Size {
pub width: u32,
pub height: u32,
}
Expand description
Represents a size
A Size
can be converted from either a tuple or array. These forms are often more ergonomic
than using the Size
struct on its own. The set_size()
method accepts either form (without needing to use into()
). See that method’s documentation
for more information.
assert_eq!(Size {width: 640, height: 480}, (640, 480).into());
assert_eq!(Size {width: 640, height: 480}, [640, 480].into());
You can access the width
and height
fields directly on any Size
struct.
let size: Size = (800, 600).into();
assert_eq!(size.width, 800);
assert_eq!(size.height, 600);
Fields§
§width: u32
The width in pixels
height: u32
The height in pixels
Trait Implementations§
impl Copy for Size
impl Eq for Size
impl StructuralPartialEq for Size
Auto Trait Implementations§
impl Freeze for Size
impl RefUnwindSafe for Size
impl Send for Size
impl Sync for Size
impl Unpin for Size
impl UnwindSafe for Size
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