diff --git a/framework-crates/objc2-foundation/src/__macro_helpers/ns_string.rs b/framework-crates/objc2-foundation/src/__macro_helpers/ns_string.rs index d993dc9f5..76c2aee37 100644 --- a/framework-crates/objc2-foundation/src/__macro_helpers/ns_string.rs +++ b/framework-crates/objc2-foundation/src/__macro_helpers/ns_string.rs @@ -15,7 +15,7 @@ //! `utf16_lit`, `windows`, `const_utf16`, `wide-literals`, ... use core::ffi::c_void; -use crate::Foundation::NSString; +use crate::NSString; use objc2::runtime::AnyClass; // This is defined in CoreFoundation, but we don't emit a link attribute diff --git a/framework-crates/objc2-foundation/src/attributed_string.rs b/framework-crates/objc2-foundation/src/attributed_string.rs index 658898c12..c2eec9907 100644 --- a/framework-crates/objc2-foundation/src/attributed_string.rs +++ b/framework-crates/objc2-foundation/src/attributed_string.rs @@ -4,7 +4,7 @@ use core::panic::{RefUnwindSafe, UnwindSafe}; use objc2::rc::Retained; use objc2::AllocAnyThread; -use crate::Foundation::*; +use crate::*; // Same reasoning as `NSString`. impl UnwindSafe for NSAttributedString {} diff --git a/framework-crates/objc2-foundation/src/bundle.rs b/framework-crates/objc2-foundation/src/bundle.rs index 70014091f..e27c1d1e4 100644 --- a/framework-crates/objc2-foundation/src/bundle.rs +++ b/framework-crates/objc2-foundation/src/bundle.rs @@ -1,7 +1,7 @@ use core::fmt; use core::panic::{RefUnwindSafe, UnwindSafe}; -use crate::Foundation::NSBundle; +use crate::NSBundle; impl UnwindSafe for NSBundle {} impl RefUnwindSafe for NSBundle {} @@ -9,8 +9,8 @@ impl RefUnwindSafe for NSBundle {} impl NSBundle { #[cfg(feature = "NSString")] #[cfg(feature = "NSDictionary")] - pub fn name(&self) -> Option> { - use crate::{ns_string, Foundation::NSString}; + pub fn name(&self) -> Option> { + use crate::{ns_string, NSString}; use objc2::rc::Retained; let info = self.infoDictionary()?; diff --git a/framework-crates/objc2-foundation/src/data.rs b/framework-crates/objc2-foundation/src/data.rs index b8129e6bd..9c8e3f9ae 100644 --- a/framework-crates/objc2-foundation/src/data.rs +++ b/framework-crates/objc2-foundation/src/data.rs @@ -13,7 +13,7 @@ use objc2::rc::Retained; use objc2::rc::RetainedFromIterator; use objc2::{extern_methods, AllocAnyThread}; -use crate::Foundation::{NSData, NSMutableData}; +use crate::{NSData, NSMutableData}; impl UnwindSafe for NSData {} impl RefUnwindSafe for NSData {} diff --git a/framework-crates/objc2-foundation/src/error.rs b/framework-crates/objc2-foundation/src/error.rs index 0093c602e..6afd58326 100644 --- a/framework-crates/objc2-foundation/src/error.rs +++ b/framework-crates/objc2-foundation/src/error.rs @@ -2,7 +2,7 @@ use core::fmt; use core::panic::{RefUnwindSafe, UnwindSafe}; -use crate::Foundation::NSError; +use crate::NSError; impl UnwindSafe for NSError {} impl RefUnwindSafe for NSError {} diff --git a/framework-crates/objc2-foundation/src/exception.rs b/framework-crates/objc2-foundation/src/exception.rs index 8451efd01..895c34721 100644 --- a/framework-crates/objc2-foundation/src/exception.rs +++ b/framework-crates/objc2-foundation/src/exception.rs @@ -8,7 +8,7 @@ use objc2::rc::Retained; use objc2::runtime::{NSObject, NSObjectProtocol}; use objc2::{extern_methods, sel}; -use crate::Foundation::NSException; +use crate::NSException; // SAFETY: Exception objects are immutable data containers, and documented as // thread safe. @@ -33,9 +33,9 @@ impl NSException { #[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))] #[cfg(feature = "NSDictionary")] pub fn new( - name: &crate::Foundation::NSExceptionName, - reason: Option<&crate::Foundation::NSString>, - user_info: Option<&crate::Foundation::NSDictionary>, + name: &crate::NSExceptionName, + reason: Option<&crate::NSString>, + user_info: Option<&crate::NSDictionary>, ) -> Option> { use objc2::AllocAnyThread; diff --git a/framework-crates/objc2-foundation/src/geometry.rs b/framework-crates/objc2-foundation/src/geometry.rs index 9f707e091..86ece2724 100644 --- a/framework-crates/objc2-foundation/src/geometry.rs +++ b/framework-crates/objc2-foundation/src/geometry.rs @@ -422,7 +422,7 @@ mod tests { ))] #[cfg(feature = "NSGeometry")] fn test_partial_eq() { - use crate::Foundation::{NSEqualPoints, NSEqualRects, NSEqualSizes}; + use crate::{NSEqualPoints, NSEqualRects, NSEqualSizes}; // We assume that comparisons handle e.g. `x` and `y` in the same way, // therefore we set the coordinates / dimensions to the same. diff --git a/framework-crates/objc2-foundation/src/iter.rs b/framework-crates/objc2-foundation/src/iter.rs index f509e800e..485c463bd 100644 --- a/framework-crates/objc2-foundation/src/iter.rs +++ b/framework-crates/objc2-foundation/src/iter.rs @@ -8,7 +8,7 @@ use objc2::runtime::ProtocolObject; use objc2::ClassType; use objc2::Message; -use crate::Foundation::{NSFastEnumeration, NSFastEnumerationState}; +use crate::{NSFastEnumeration, NSFastEnumerationState}; /// Swift and Objective-C both have a stack buffer size of 16, so we do that /// as well. @@ -654,11 +654,10 @@ macro_rules! __impl_into_iter { #[cfg(feature = "NSValue")] mod tests { use alloc::vec::Vec; - - use super::*; use core::mem::size_of; - use crate::Foundation::{NSArray, NSNumber}; + use super::*; + use crate::{NSArray, NSNumber}; #[test] #[cfg_attr( diff --git a/framework-crates/objc2-foundation/src/lib.rs b/framework-crates/objc2-foundation/src/lib.rs index 89e887aa7..b159a6411 100644 --- a/framework-crates/objc2-foundation/src/lib.rs +++ b/framework-crates/objc2-foundation/src/lib.rs @@ -184,9 +184,3 @@ pub(crate) type FourCharCode = u32; pub type OSType = FourCharCode; #[allow(unused)] pub(crate) type UTF32Char = u32; // Or maybe Rust's char? - -// Temporary -#[allow(non_snake_case, unused, unreachable_pub)] -mod Foundation { - pub use crate::*; -} diff --git a/framework-crates/objc2-foundation/src/macros/ns_string.rs b/framework-crates/objc2-foundation/src/macros/ns_string.rs index 7aacb67b6..0ca689ba9 100644 --- a/framework-crates/objc2-foundation/src/macros/ns_string.rs +++ b/framework-crates/objc2-foundation/src/macros/ns_string.rs @@ -2,7 +2,7 @@ /// /// Equivalent to the [boxed C-strings] `@"string"` syntax in Objective-C. /// -/// [`NSString`]: crate::Foundation::NSString +/// [`NSString`]: crate::NSString /// [boxed C-strings]: https://clang.llvm.org/docs/ObjectiveCLiterals.html#boxed-c-strings /// /// diff --git a/framework-crates/objc2-foundation/src/ns_consumed.rs b/framework-crates/objc2-foundation/src/ns_consumed.rs index c376c433e..faad1f613 100644 --- a/framework-crates/objc2-foundation/src/ns_consumed.rs +++ b/framework-crates/objc2-foundation/src/ns_consumed.rs @@ -1,6 +1,6 @@ extern "C" { #[cfg(feature = "NSMapTable")] - pub fn NSFreeMapTable(table: *mut crate::Foundation::NSMapTable); + pub fn NSFreeMapTable(table: *mut crate::NSMapTable); } // TODO: Add `-[NSKeyedUnarchiverDelegate unarchiver:didDecodeObject:]` diff --git a/framework-crates/objc2-foundation/src/number.rs b/framework-crates/objc2-foundation/src/number.rs index 5c4384d55..41247c289 100644 --- a/framework-crates/objc2-foundation/src/number.rs +++ b/framework-crates/objc2-foundation/src/number.rs @@ -24,7 +24,7 @@ use core::panic::{RefUnwindSafe, UnwindSafe}; use objc2::encode::Encoding; use objc2::rc::Retained; -use crate::Foundation::NSNumber; +use crate::NSNumber; impl UnwindSafe for NSNumber {} impl RefUnwindSafe for NSNumber {} @@ -61,7 +61,7 @@ impl NSNumber { #[inline] #[cfg(feature = "NSGeometry")] - pub fn new_cgfloat(val: crate::Foundation::CGFloat) -> Retained { + pub fn new_cgfloat(val: crate::CGFloat) -> Retained { #[cfg(target_pointer_width = "64")] { Self::new_f64(val) @@ -105,7 +105,7 @@ impl NSNumber { #[inline] #[cfg(feature = "NSGeometry")] - pub fn as_cgfloat(&self) -> crate::Foundation::CGFloat { + pub fn as_cgfloat(&self) -> crate::CGFloat { #[cfg(target_pointer_width = "64")] { self.as_f64() diff --git a/framework-crates/objc2-foundation/src/process_info.rs b/framework-crates/objc2-foundation/src/process_info.rs index 66768ee8f..e7c86c4aa 100644 --- a/framework-crates/objc2-foundation/src/process_info.rs +++ b/framework-crates/objc2-foundation/src/process_info.rs @@ -2,7 +2,7 @@ use core::fmt; use core::panic::{RefUnwindSafe, UnwindSafe}; -use crate::Foundation::NSProcessInfo; +use crate::NSProcessInfo; // SAFETY: The documentation explicitly states: // > NSProcessInfo is thread-safe in macOS 10.7 and later. diff --git a/framework-crates/objc2-foundation/src/range.rs b/framework-crates/objc2-foundation/src/range.rs index b02053bf1..7e8ee793c 100644 --- a/framework-crates/objc2-foundation/src/range.rs +++ b/framework-crates/objc2-foundation/src/range.rs @@ -2,7 +2,7 @@ use core::ops::Range; use objc2::encode::{Encode, Encoding, RefEncode}; -use crate::Foundation::NSUInteger; +use crate::NSUInteger; /// TODO. /// diff --git a/framework-crates/objc2-foundation/src/string.rs b/framework-crates/objc2-foundation/src/string.rs index 68cd4dcd2..788d8b3e1 100644 --- a/framework-crates/objc2-foundation/src/string.rs +++ b/framework-crates/objc2-foundation/src/string.rs @@ -170,7 +170,7 @@ impl NSString { /// /// Prefer using the [`ns_string!`] macro when possible. /// - /// [`ns_string!`]: crate::Foundation::ns_string + /// [`ns_string!`]: crate::ns_string #[doc(alias = "initWithBytes")] #[doc(alias = "initWithBytes:length:encoding:")] #[allow(clippy::should_implement_trait)] // Not really sure of a better name diff --git a/framework-crates/objc2-foundation/src/tests/attributed_string.rs b/framework-crates/objc2-foundation/src/tests/attributed_string.rs index 313132a9a..dea05722d 100644 --- a/framework-crates/objc2-foundation/src/tests/attributed_string.rs +++ b/framework-crates/objc2-foundation/src/tests/attributed_string.rs @@ -6,7 +6,7 @@ use alloc::string::ToString; use objc2::rc::{autoreleasepool, Retained}; use objc2::runtime::AnyObject; -use crate::Foundation::{self, ns_string, NSAttributedString, NSObject, NSString}; +use crate::{ns_string, NSAttributedString, NSMutableAttributedString, NSObject, NSString}; #[test] fn test_new() { @@ -32,7 +32,7 @@ fn test_from_nsstring() { #[test] fn test_copy() { - use Foundation::{NSCopying, NSMutableCopying, NSObjectProtocol}; + use crate::{NSCopying, NSMutableCopying, NSObjectProtocol}; let s1 = NSAttributedString::from_nsstring(ns_string!("abc")); let s2 = s1.copy(); @@ -43,7 +43,7 @@ fn test_copy() { let s3 = s1.mutableCopy(); assert_ne!(Retained::as_ptr(&s1), Retained::as_ptr(&s3).cast()); - assert!(s3.is_kind_of::()); + assert!(s3.is_kind_of::()); } #[test] @@ -62,7 +62,7 @@ fn test_debug() { let s = unsafe { NSAttributedString::new_with_attributes( ns_string!("abc"), - &Foundation::NSDictionary::from_retained_objects(&[ns_string!("test")], &[obj]), + &crate::NSDictionary::from_retained_objects(&[ns_string!("test")], &[obj]), ) }; let expected = if cfg!(feature = "gnustep-1-7") { @@ -75,7 +75,7 @@ fn test_debug() { #[test] fn test_new_mutable() { - let s = Foundation::NSMutableAttributedString::new(); + let s = NSMutableAttributedString::new(); assert_eq!(&s.string().to_string(), ""); } @@ -85,14 +85,14 @@ fn test_new_mutable() { ignore = "thread safety issues regarding initialization" )] fn test_copy_mutable() { - use Foundation::{NSCopying, NSMutableCopying, NSObjectProtocol}; + use crate::{NSCopying, NSMutableCopying, NSObjectProtocol}; - let s1 = Foundation::NSMutableAttributedString::from_nsstring(ns_string!("abc")); + let s1 = NSMutableAttributedString::from_nsstring(ns_string!("abc")); let s2 = s1.copy(); assert_ne!(Retained::as_ptr(&s1).cast(), Retained::as_ptr(&s2)); assert!(s2.is_kind_of::()); let s3 = s1.mutableCopy(); assert_ne!(Retained::as_ptr(&s1), Retained::as_ptr(&s3)); - assert!(s3.is_kind_of::()); + assert!(s3.is_kind_of::()); } diff --git a/framework-crates/objc2-foundation/src/tests/bundle.rs b/framework-crates/objc2-foundation/src/tests/bundle.rs index c8801ddf0..38dbcf514 100644 --- a/framework-crates/objc2-foundation/src/tests/bundle.rs +++ b/framework-crates/objc2-foundation/src/tests/bundle.rs @@ -1,7 +1,7 @@ #![cfg(feature = "NSBundle")] use alloc::format; -use crate::Foundation::NSBundle; +use crate::NSBundle; #[test] #[cfg(feature = "NSString")] diff --git a/framework-crates/objc2-foundation/src/tests/data.rs b/framework-crates/objc2-foundation/src/tests/data.rs index f27b92861..dc8844d82 100644 --- a/framework-crates/objc2-foundation/src/tests/data.rs +++ b/framework-crates/objc2-foundation/src/tests/data.rs @@ -1,7 +1,7 @@ #![cfg(feature = "NSData")] use alloc::{format, vec}; -use crate::Foundation::NSData; +use crate::NSData; #[test] fn test_bytes() { diff --git a/framework-crates/objc2-foundation/src/tests/error.rs b/framework-crates/objc2-foundation/src/tests/error.rs index c30323cae..11e295f1f 100644 --- a/framework-crates/objc2-foundation/src/tests/error.rs +++ b/framework-crates/objc2-foundation/src/tests/error.rs @@ -2,7 +2,7 @@ #![cfg(feature = "NSString")] use alloc::format; -use crate::Foundation::{ns_string, NSCocoaErrorDomain, NSError}; +use crate::{ns_string, NSCocoaErrorDomain, NSError}; #[test] fn basic() { diff --git a/framework-crates/objc2-foundation/src/tests/lock.rs b/framework-crates/objc2-foundation/src/tests/lock.rs index 871d9dcac..9c6fd7e23 100644 --- a/framework-crates/objc2-foundation/src/tests/lock.rs +++ b/framework-crates/objc2-foundation/src/tests/lock.rs @@ -1,5 +1,5 @@ #![cfg(feature = "NSLock")] -use crate::Foundation::{NSLock, NSLocking}; +use crate::{NSLock, NSLocking}; #[test] fn lock_unlock() { diff --git a/framework-crates/objc2-foundation/src/tests/mutable_data.rs b/framework-crates/objc2-foundation/src/tests/mutable_data.rs index 0c2309be6..b061cb263 100644 --- a/framework-crates/objc2-foundation/src/tests/mutable_data.rs +++ b/framework-crates/objc2-foundation/src/tests/mutable_data.rs @@ -1,6 +1,6 @@ #![cfg(feature = "NSData")] -use crate::Foundation::{NSData, NSMutableData}; +use crate::{NSData, NSMutableData}; #[test] fn test_bytes_mut() { diff --git a/framework-crates/objc2-foundation/src/tests/mutable_string.rs b/framework-crates/objc2-foundation/src/tests/mutable_string.rs index e81b4d80d..2f9249068 100644 --- a/framework-crates/objc2-foundation/src/tests/mutable_string.rs +++ b/framework-crates/objc2-foundation/src/tests/mutable_string.rs @@ -5,8 +5,8 @@ use core::any::TypeId; use core::fmt::Write; use objc2::runtime::NSObject; -use crate::Foundation::{NSMutableString, NSString}; use crate::{CopyingHelper, MutableCopyingHelper}; +use crate::{NSMutableString, NSString}; #[test] fn display_debug() { @@ -50,7 +50,7 @@ fn test_with_capacity() { #[test] #[cfg(feature = "NSObject")] fn test_copy() { - use crate::Foundation::{NSCopying, NSMutableCopying, NSObjectProtocol}; + use crate::{NSCopying, NSMutableCopying, NSObjectProtocol}; use objc2::rc::Retained; let s1 = NSMutableString::from_str("abc"); @@ -87,7 +87,7 @@ fn counterpart() { #[test] #[cfg(all(feature = "NSObject", feature = "NSZone"))] fn test_copy_with_zone() { - use crate::Foundation::{NSCopying, NSMutableCopying, NSObjectProtocol}; + use crate::{NSCopying, NSMutableCopying, NSObjectProtocol}; use objc2::rc::Retained; let s1 = NSString::from_str("abc"); diff --git a/framework-crates/objc2-foundation/src/tests/number.rs b/framework-crates/objc2-foundation/src/tests/number.rs index 621728ac6..7a1662a3a 100644 --- a/framework-crates/objc2-foundation/src/tests/number.rs +++ b/framework-crates/objc2-foundation/src/tests/number.rs @@ -1,7 +1,7 @@ #![cfg(feature = "NSValue")] use alloc::format; -use crate::Foundation::NSNumber; +use crate::NSNumber; #[test] fn basic() { diff --git a/framework-crates/objc2-foundation/src/tests/process_info.rs b/framework-crates/objc2-foundation/src/tests/process_info.rs index 29cc68391..b403df50c 100644 --- a/framework-crates/objc2-foundation/src/tests/process_info.rs +++ b/framework-crates/objc2-foundation/src/tests/process_info.rs @@ -2,7 +2,7 @@ #![cfg(feature = "NSProcessInfo")] use alloc::format; -use crate::Foundation::NSProcessInfo; +use crate::NSProcessInfo; #[test] fn debug() { diff --git a/framework-crates/objc2-foundation/src/tests/proxy.rs b/framework-crates/objc2-foundation/src/tests/proxy.rs index 6b14970ea..9c0724973 100644 --- a/framework-crates/objc2-foundation/src/tests/proxy.rs +++ b/framework-crates/objc2-foundation/src/tests/proxy.rs @@ -1,5 +1,5 @@ #![cfg(feature = "NSProxy")] -use crate::Foundation::NSProxy; +use crate::NSProxy; use objc2::ClassType; #[test] diff --git a/framework-crates/objc2-foundation/src/tests/string.rs b/framework-crates/objc2-foundation/src/tests/string.rs index 6b5474a54..b3691eac8 100644 --- a/framework-crates/objc2-foundation/src/tests/string.rs +++ b/framework-crates/objc2-foundation/src/tests/string.rs @@ -4,7 +4,7 @@ use alloc::string::ToString; use objc2::rc::autoreleasepool; -use crate::Foundation::{ns_string, NSString}; +use crate::{ns_string, NSString}; #[test] fn test_equality() { @@ -79,7 +79,7 @@ fn test_interior_nul() { #[test] #[cfg(feature = "NSObject")] fn test_copy() { - use crate::Foundation::{NSCopying, NSMutableCopying, NSMutableString, NSObjectProtocol}; + use crate::{NSCopying, NSMutableCopying, NSMutableString, NSObjectProtocol}; use objc2::rc::Retained; let s1 = NSString::from_str("abc"); @@ -96,7 +96,7 @@ fn test_copy() { #[test] #[cfg(feature = "NSObject")] fn test_copy_nsstring_is_same() { - use crate::Foundation::NSCopying; + use crate::NSCopying; let string1 = NSString::from_str("Hello, world!"); let string2 = string1.copy(); diff --git a/framework-crates/objc2-foundation/src/tests/uuid.rs b/framework-crates/objc2-foundation/src/tests/uuid.rs index 38edc9ab2..b23bc30fe 100644 --- a/framework-crates/objc2-foundation/src/tests/uuid.rs +++ b/framework-crates/objc2-foundation/src/tests/uuid.rs @@ -1,7 +1,7 @@ #![cfg(feature = "NSUUID")] use alloc::format; -use crate::Foundation::NSUUID; +use crate::NSUUID; use objc2::rc::Retained; #[test] diff --git a/framework-crates/objc2-foundation/src/tests/value.rs b/framework-crates/objc2-foundation/src/tests/value.rs index 0a0ed1601..2b3e31272 100644 --- a/framework-crates/objc2-foundation/src/tests/value.rs +++ b/framework-crates/objc2-foundation/src/tests/value.rs @@ -5,7 +5,7 @@ use core::ffi::CStr; use core::slice; use core::str; -use crate::Foundation::NSValue; +use crate::NSValue; #[test] fn basic() { @@ -48,7 +48,7 @@ fn test_debug() { #[test] #[cfg(feature = "NSRange")] fn nsrange() { - use crate::Foundation::NSRange; + use crate::NSRange; let range = NSRange::from(1..2); let val = NSValue::new(range); assert_eq!(val.get_range(), Some(range)); @@ -66,7 +66,7 @@ fn nsrange() { #[test] #[cfg(feature = "NSGeometry")] fn nspoint() { - use crate::Foundation::NSPoint; + use crate::NSPoint; let point = NSPoint::new(1.0, 2.0); let val = NSValue::new(point); assert_eq!(val.get_point(), Some(point)); @@ -77,7 +77,7 @@ fn nspoint() { #[test] #[cfg(feature = "NSGeometry")] fn nssize() { - use crate::Foundation::NSSize; + use crate::NSSize; let point = NSSize::new(1.0, 2.0); let val = NSValue::new(point); assert_eq!(val.get_size(), Some(point)); @@ -88,7 +88,7 @@ fn nssize() { #[test] #[cfg(feature = "NSGeometry")] fn nsrect() { - use crate::Foundation::{NSPoint, NSRect, NSSize}; + use crate::{NSPoint, NSRect, NSSize}; let rect = NSRect::new(NSPoint::new(1.0, 2.0), NSSize::new(3.0, 4.0)); let val = NSValue::new(rect); assert_eq!(val.get_rect(), Some(rect)); diff --git a/framework-crates/objc2-foundation/src/thread.rs b/framework-crates/objc2-foundation/src/thread.rs index 79458881a..4ad3dedef 100644 --- a/framework-crates/objc2-foundation/src/thread.rs +++ b/framework-crates/objc2-foundation/src/thread.rs @@ -1,7 +1,7 @@ use core::fmt; use core::panic::{RefUnwindSafe, UnwindSafe}; -use crate::Foundation::NSThread; +use crate::NSThread; use objc2::MainThreadMarker; @@ -14,7 +14,7 @@ impl RefUnwindSafe for NSThread {} impl fmt::Debug for NSThread { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { // Use -[NSThread description] since that includes the thread number - let obj: &crate::Foundation::NSObject = self; + let obj: &crate::NSObject = self; fmt::Debug::fmt(obj, f) } } diff --git a/framework-crates/objc2-foundation/src/to_owned.rs b/framework-crates/objc2-foundation/src/to_owned.rs index 805fd4eaf..a94795c50 100644 --- a/framework-crates/objc2-foundation/src/to_owned.rs +++ b/framework-crates/objc2-foundation/src/to_owned.rs @@ -4,10 +4,10 @@ use alloc::borrow::ToOwned; use objc2::rc::Retained; use objc2::Message; -use crate::Foundation::{self, NSCopying, NSMutableCopying}; +use crate::{NSCopying, NSMutableCopying}; #[cfg(feature = "NSArray")] -impl ToOwned for Foundation::NSArray { +impl ToOwned for crate::NSArray { type Owned = Retained; fn to_owned(&self) -> Self::Owned { self.copy() @@ -15,7 +15,7 @@ impl ToOwned for Foundation::NSArray { } #[cfg(feature = "NSArray")] -impl ToOwned for Foundation::NSMutableArray { +impl ToOwned for crate::NSMutableArray { type Owned = Retained; fn to_owned(&self) -> Self::Owned { self.mutableCopy() @@ -23,7 +23,7 @@ impl ToOwned for Foundation::NSMutableArray { } #[cfg(feature = "NSData")] -impl ToOwned for Foundation::NSData { +impl ToOwned for crate::NSData { type Owned = Retained; fn to_owned(&self) -> Self::Owned { self.copy() @@ -31,7 +31,7 @@ impl ToOwned for Foundation::NSData { } #[cfg(feature = "NSData")] -impl ToOwned for Foundation::NSMutableData { +impl ToOwned for crate::NSMutableData { type Owned = Retained; fn to_owned(&self) -> Self::Owned { self.mutableCopy() @@ -39,7 +39,7 @@ impl ToOwned for Foundation::NSMutableData { } #[cfg(feature = "NSException")] -impl ToOwned for Foundation::NSException { +impl ToOwned for crate::NSException { type Owned = Retained; fn to_owned(&self) -> Self::Owned { self.copy() @@ -47,7 +47,7 @@ impl ToOwned for Foundation::NSException { } #[cfg(feature = "NSSet")] -impl ToOwned for Foundation::NSSet { +impl ToOwned for crate::NSSet { type Owned = Retained; fn to_owned(&self) -> Self::Owned { self.copy() @@ -55,7 +55,7 @@ impl ToOwned for Foundation::NSSet { } #[cfg(feature = "NSSet")] -impl ToOwned for Foundation::NSMutableSet { +impl ToOwned for crate::NSMutableSet { type Owned = Retained; fn to_owned(&self) -> Self::Owned { self.mutableCopy() @@ -63,7 +63,7 @@ impl ToOwned for Foundation::NSMutableSet { } #[cfg(feature = "NSString")] -impl ToOwned for Foundation::NSString { +impl ToOwned for crate::NSString { type Owned = Retained; fn to_owned(&self) -> Self::Owned { self.copy() @@ -71,7 +71,7 @@ impl ToOwned for Foundation::NSString { } #[cfg(feature = "NSString")] -impl ToOwned for Foundation::NSMutableString { +impl ToOwned for crate::NSMutableString { type Owned = Retained; fn to_owned(&self) -> Self::Owned { self.mutableCopy() @@ -79,7 +79,7 @@ impl ToOwned for Foundation::NSMutableString { } #[cfg(feature = "NSAttributedString")] -impl ToOwned for Foundation::NSAttributedString { +impl ToOwned for crate::NSAttributedString { type Owned = Retained; fn to_owned(&self) -> Self::Owned { self.copy() @@ -87,7 +87,7 @@ impl ToOwned for Foundation::NSAttributedString { } #[cfg(feature = "NSAttributedString")] -impl ToOwned for Foundation::NSMutableAttributedString { +impl ToOwned for crate::NSMutableAttributedString { type Owned = Retained; fn to_owned(&self) -> Self::Owned { self.mutableCopy() @@ -95,7 +95,7 @@ impl ToOwned for Foundation::NSMutableAttributedString { } #[cfg(feature = "NSUUID")] -impl ToOwned for Foundation::NSUUID { +impl ToOwned for crate::NSUUID { type Owned = Retained; fn to_owned(&self) -> Self::Owned { self.copy() @@ -103,7 +103,7 @@ impl ToOwned for Foundation::NSUUID { } #[cfg(feature = "NSValue")] -impl ToOwned for Foundation::NSValue { +impl ToOwned for crate::NSValue { type Owned = Retained; fn to_owned(&self) -> Self::Owned { self.copy() @@ -111,7 +111,7 @@ impl ToOwned for Foundation::NSValue { } #[cfg(feature = "NSValue")] -impl ToOwned for Foundation::NSNumber { +impl ToOwned for crate::NSNumber { type Owned = Retained; fn to_owned(&self) -> Self::Owned { self.copy() diff --git a/framework-crates/objc2-foundation/src/uuid.rs b/framework-crates/objc2-foundation/src/uuid.rs index 0a380861d..a3e3132b6 100644 --- a/framework-crates/objc2-foundation/src/uuid.rs +++ b/framework-crates/objc2-foundation/src/uuid.rs @@ -6,7 +6,7 @@ use objc2::encode::{Encode, Encoding, RefEncode}; use objc2::rc::{Allocated, Retained}; use objc2::{extern_methods, AllocAnyThread}; -use crate::Foundation::NSUUID; +use crate::NSUUID; impl UnwindSafe for NSUUID {} impl RefUnwindSafe for NSUUID {} diff --git a/framework-crates/objc2-foundation/src/value.rs b/framework-crates/objc2-foundation/src/value.rs index d4eab2d4b..1c48ef1ec 100644 --- a/framework-crates/objc2-foundation/src/value.rs +++ b/framework-crates/objc2-foundation/src/value.rs @@ -11,7 +11,7 @@ use objc2::encode::Encode; use objc2::rc::Retained; use objc2::AllocAnyThread; -use crate::Foundation::NSValue; +use crate::NSValue; // We can't implement any auto traits for NSValue, since it can contain an // arbitary object! @@ -34,7 +34,7 @@ impl NSValue { /// let val = NSValue::new(42i32); /// ``` /// - /// [`NSPoint`]: crate::Foundation::NSPoint + /// [`NSPoint`]: crate::NSPoint pub fn new(value: T) -> Retained { let bytes: NonNull = NonNull::from(&value); let encoding = CString::new(T::ENCODING.to_string()).unwrap(); @@ -105,8 +105,8 @@ impl NSValue { } #[cfg(feature = "NSRange")] - pub fn get_range(&self) -> Option { - if self.contains_encoding::() { + pub fn get_range(&self) -> Option { + if self.contains_encoding::() { // SAFETY: We just checked that this contains an NSRange Some(unsafe { self.rangeValue() }) } else { @@ -115,8 +115,8 @@ impl NSValue { } #[cfg(feature = "NSGeometry")] - pub fn get_point(&self) -> Option { - if self.contains_encoding::() { + pub fn get_point(&self) -> Option { + if self.contains_encoding::() { // SAFETY: We just checked that this contains an NSPoint // // Note: The documentation says that `pointValue`, `sizeValue` and @@ -129,8 +129,8 @@ impl NSValue { } #[cfg(feature = "NSGeometry")] - pub fn get_size(&self) -> Option { - if self.contains_encoding::() { + pub fn get_size(&self) -> Option { + if self.contains_encoding::() { // SAFETY: We just checked that this contains an NSSize Some(unsafe { self.sizeValue() }) } else { @@ -139,8 +139,8 @@ impl NSValue { } #[cfg(feature = "NSGeometry")] - pub fn get_rect(&self) -> Option { - if self.contains_encoding::() { + pub fn get_rect(&self) -> Option { + if self.contains_encoding::() { // SAFETY: We just checked that this contains an NSRect Some(unsafe { self.rectValue() }) } else {