Struct objc2_foundation::NSRect
source · [−]Expand description
The location and dimensions of a rectangle.
In the default Core Graphics coordinate space (macOS), the origin is located in the lower-left corner of the rectangle and the rectangle extends towards the upper-right corner.
If the context has a flipped coordinate space (iOS, tvOS, watchOS) the origin is in the upper-left corner and the rectangle extends towards the lower-right corner.
For ease of use, this is available on all platforms, though in practice it is only useful on macOS.
See Apple’s documentation.
and the related core_graphics_types::geometry::CGRect
.
Fields
origin: NSPoint
The coordinates of the rectangle’s origin.
size: NSSize
The dimensions of the rectangle.
Implementations
sourceimpl NSRect
impl NSRect
sourcepub const fn new(origin: NSPoint, size: NSSize) -> Self
pub const fn new(origin: NSPoint, size: NSSize) -> Self
Create a new rectangle with the given origin and dimensions.
Examples
use objc2_foundation::{NSPoint, NSRect, NSSize};
let origin = NSPoint::new(10.0, -2.3);
let size = NSSize::new(5.0, 0.0);
let rect = NSRect::new(origin, size);
Trait Implementations
sourceimpl RefEncode for NSRect
impl RefEncode for NSRect
sourceconst ENCODING_REF: Encoding<'static> = Encoding::Pointer(&Self::ENCODING)
const ENCODING_REF: Encoding<'static> = Encoding::Pointer(&Self::ENCODING)
The Objective-C type-encoding for a reference of this type. Read more
impl Copy for NSRect
impl StructuralPartialEq for NSRect
Auto Trait Implementations
impl RefUnwindSafe for NSRect
impl Send for NSRect
impl Sync for NSRect
impl Unpin for NSRect
impl UnwindSafe for NSRect
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more