From ff18c50631293ab6a341d3c948f4e68e5f59cd16 Mon Sep 17 00:00:00 2001 From: Felix Kaaman Date: Sat, 27 Feb 2016 21:27:34 +0100 Subject: [PATCH] Add NSRange --- src/foundation.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/foundation.rs b/src/foundation.rs index d0a1184..262bc6d 100644 --- a/src/foundation.rs +++ b/src/foundation.rs @@ -89,6 +89,22 @@ impl NSRect { } } +#[repr(C)] +pub struct NSRange { + pub location: NSUInteger, + pub length: NSUInteger, +} + +impl NSRange { + #[inline] + pub fn new(location: NSUInteger, length: NSUInteger) -> NSRange { + NSRange { + location: location, + length: length + } + } +} + unsafe impl objc::Encode for NSRect { fn encode() -> objc::Encoding { let encoding = format!("{{CGRect={}{}}}",