Struct CGSize
#[repr(C)]pub struct CGSize {
pub width: f64,
pub height: f64,
}Expand description
CGSize representation
Represents a 2D size with width and height.
§Examples
use apple_cf::cg::CGSize;
let size = CGSize::new(1920.0, 1080.0);
assert_eq!(size.aspect_ratio(), 1920.0 / 1080.0);
assert_eq!(size.area(), 1920.0 * 1080.0);Fields§
§width: f64§height: f64Implementations§
§impl CGSize
impl CGSize
pub const fn new(width: f64, height: f64) -> CGSize
pub const fn new(width: f64, height: f64) -> CGSize
Create a new size
§Examples
use apple_cf::cg::CGSize;
let size = CGSize::new(800.0, 600.0);
assert_eq!(size.width, 800.0);pub const fn zero() -> CGSize
pub const fn zero() -> CGSize
Create a zero-sized size
§Examples
use apple_cf::cg::CGSize;
let size = CGSize::zero();
assert!(size.is_null());pub fn aspect_ratio(&self) -> f64
pub fn aspect_ratio(&self) -> f64
Get the aspect ratio (width / height)
Trait Implementations§
impl Copy for CGSize
impl Eq for CGSize
impl StructuralPartialEq for CGSize
Auto Trait Implementations§
impl Freeze for CGSize
impl RefUnwindSafe for CGSize
impl Send for CGSize
impl Sync for CGSize
impl Unpin for CGSize
impl UnsafeUnpin for CGSize
impl UnwindSafe for CGSize
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