//! This file has been automatically generated by `objc2`'s `header-translator`. //! DO NOT EDIT use core::ptr::NonNull; use objc2::__framework_prelude::*; use crate::*; /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsrangepointer?language=objc) pub type NSRangePointer = *mut NSRange; // TODO: pub fn NSMakeRange(loc: NSUInteger,len: NSUInteger,) -> NSRange; // TODO: pub fn NSMaxRange(range: NSRange,) -> NSUInteger; // TODO: pub fn NSLocationInRange(loc: NSUInteger,range: NSRange,) -> Bool; // TODO: pub fn NSEqualRanges(range1: NSRange,range2: NSRange,) -> Bool; #[inline] pub extern "C-unwind" fn NSUnionRange(range1: NSRange, range2: NSRange) -> NSRange { extern "C-unwind" { fn NSUnionRange(range1: NSRange, range2: NSRange) -> NSRange; } unsafe { NSUnionRange(range1, range2) } } #[inline] pub extern "C-unwind" fn NSIntersectionRange(range1: NSRange, range2: NSRange) -> NSRange { extern "C-unwind" { fn NSIntersectionRange(range1: NSRange, range2: NSRange) -> NSRange; } unsafe { NSIntersectionRange(range1, range2) } } #[cfg(feature = "NSString")] impl NSString { #[doc(alias = "NSStringFromRange")] #[cfg(feature = "NSString")] #[inline] pub fn from_range(range: NSRange) -> Retained { extern "C-unwind" { fn NSStringFromRange(range: NSRange) -> *mut NSString; } let ret = unsafe { NSStringFromRange(range) }; unsafe { Retained::retain_autoreleased(ret) } .expect("function was marked as returning non-null, but actually returned NULL") } } #[cfg(feature = "NSString")] #[inline] pub extern "C-unwind" fn NSRangeFromString(a_string: &NSString) -> NSRange { extern "C-unwind" { fn NSRangeFromString(a_string: &NSString) -> NSRange; } unsafe { NSRangeFromString(a_string) } } /// NSValueRangeExtensions. #[cfg(feature = "NSValue")] impl NSValue { extern_methods!( #[unsafe(method(valueWithRange:))] #[unsafe(method_family = none)] pub unsafe fn valueWithRange(range: NSRange) -> Retained; #[unsafe(method(rangeValue))] #[unsafe(method_family = none)] pub unsafe fn rangeValue(&self) -> NSRange; ); } #[cfg(feature = "NSString")] #[deprecated = "renamed to `NSString::from_range`"] #[inline] pub extern "C-unwind" fn NSStringFromRange(range: NSRange) -> Retained { extern "C-unwind" { fn NSStringFromRange(range: NSRange) -> *mut NSString; } let ret = unsafe { NSStringFromRange(range) }; unsafe { Retained::retain_autoreleased(ret) } .expect("function was marked as returning non-null, but actually returned NULL") }