Skip to content

Commit ee3c19e

Browse files
committed
Fix doc tests
1 parent f56d1ca commit ee3c19e

File tree

9 files changed

+24
-22
lines changed

9 files changed

+24
-22
lines changed

objc-sys/src/types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ pub type NSInteger = isize;
156156
/// use objc_sys::NSUInteger;
157157
/// // Or:
158158
/// // use objc2::ffi::NSUInteger;
159-
/// // use objc2_foundation::NSUInteger;
159+
/// // use objc2::foundation::NSUInteger;
160160
/// extern "C" {
161161
/// fn some_external_function() -> NSUInteger;
162162
/// }

objc2/examples/nspasteboard.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ impl NSPasteboard {
9696
/// <https://developer.apple.com/documentation/appkit/nspasteboard/1524454-readobjectsforclasses?language=objc>
9797
pub fn text_impl_2(&self) -> Id<NSString, Shared> {
9898
// The NSPasteboard API is a bit weird, it requires you to pass
99-
// classes as objects, which `objc2_foundation::NSArray` was not
99+
// classes as objects, which `objc2::foundation::NSArray` was not
100100
// really made for - so we convert the class to an `Object` type
101101
// instead. Also, we wrap it in `ManuallyDrop` because I'm not sure
102102
// how classes handle `release` calls?

objc2/src/exception.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ use crate::runtime::Object;
4444
use crate::Message;
4545
use crate::{msg_send, msg_send_bool, msg_send_id, sel};
4646

47-
/// Unfortunate reimplementation of `objc2_foundation::NSString`.
47+
/// Unfortunate reimplementation of `objc2::foundation::NSString`.
4848
///
4949
/// I guess this is the price of wanting to do things "right"...
5050
unsafe fn to_string_hack(obj: Id<Object, Shared>) -> String {

objc2/src/foundation/geometry.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ impl NSPoint {
7171
/// # Examples
7272
///
7373
/// ```
74-
/// use objc2_foundation::NSPoint;
74+
/// use objc2::foundation::NSPoint;
7575
/// assert_eq!(NSPoint::new(10.0, -2.3), NSPoint { x: 10.0, y: -2.3 });
7676
/// ```
7777
#[inline]
@@ -129,14 +129,14 @@ impl NSSize {
129129
/// # Examples
130130
///
131131
/// ```
132-
/// use objc2_foundation::NSSize;
132+
/// use objc2::foundation::NSSize;
133133
/// let size = NSSize::new(10.0, 2.3);
134134
/// assert_eq!(size.width(), 10.0);
135135
/// assert_eq!(size.height(), 2.3);
136136
/// ```
137137
///
138138
/// ```should_panic
139-
/// use objc2_foundation::NSSize;
139+
/// use objc2::foundation::NSSize;
140140
/// let size = NSSize::new(-1.0, 0.0);
141141
/// ```
142142
#[inline]
@@ -214,7 +214,7 @@ impl NSRect {
214214
/// # Examples
215215
///
216216
/// ```
217-
/// use objc2_foundation::{NSPoint, NSRect, NSSize};
217+
/// use objc2::foundation::{NSPoint, NSRect, NSSize};
218218
/// let origin = NSPoint::new(10.0, -2.3);
219219
/// let size = NSSize::new(5.0, 0.0);
220220
/// let rect = NSRect::new(origin, size);

objc2/src/foundation/range.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ impl NSRange {
2222
/// # Examples
2323
///
2424
/// ```
25-
/// use objc2_foundation::NSRange;
25+
/// use objc2::foundation::NSRange;
2626
/// assert_eq!(NSRange::new(3, 2), NSRange::from(3..5));
2727
/// ```
2828
#[inline]
@@ -37,7 +37,7 @@ impl NSRange {
3737
/// # Examples
3838
///
3939
/// ```
40-
/// use objc2_foundation::NSRange;
40+
/// use objc2::foundation::NSRange;
4141
///
4242
/// assert!(!NSRange::from(3..5).is_empty());
4343
/// assert!( NSRange::from(3..3).is_empty());
@@ -52,7 +52,7 @@ impl NSRange {
5252
/// # Examples
5353
///
5454
/// ```
55-
/// use objc2_foundation::NSRange;
55+
/// use objc2::foundation::NSRange;
5656
///
5757
/// assert!(!NSRange::from(3..5).contains(2));
5858
/// assert!( NSRange::from(3..5).contains(3));

objc2/src/foundation/thread.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,9 @@ fn make_multithreaded() {
9898
/// Use when designing APIs that are only safe to use on the main thread:
9999
///
100100
/// ```no_run
101-
/// use objc2::msg_send;
101+
/// use objc2::foundation::MainThreadMarker;
102102
/// use objc2::runtime::Object;
103-
/// use objc2_foundation::MainThreadMarker;
103+
/// use objc2::msg_send;
104104
/// # let obj = 0 as *const Object;
105105
///
106106
/// // This action requires the main thread, so we take a marker as parameter.

objc2/src/macros/declare_class.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,10 +322,10 @@ macro_rules! __inner_declare_class {
322322
///
323323
/// ```
324324
/// use std::os::raw::c_int;
325-
/// use objc2::{msg_send, msg_send_bool, msg_send_id};
325+
/// use objc2::{declare_class, msg_send, msg_send_bool, msg_send_id};
326326
/// use objc2::rc::{Id, Owned};
327+
/// use objc2::foundation::{NSCopying, NSObject, NSZone};
327328
/// use objc2::runtime::Bool;
328-
/// use objc2_foundation::{declare_class, NSCopying, NSObject, NSZone};
329329
/// #
330330
/// # #[cfg(feature = "gnustep-1-7")]
331331
/// # unsafe { objc2::__gnustep_hack::get_class_to_force_linkage() };

objc2/src/macros/extern_class.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@
5252
/// Create a new type to represent the `NSFormatter` class.
5353
///
5454
/// ```
55-
/// use objc2::msg_send_id;
55+
/// use objc2::foundation::NSObject;
5656
/// use objc2::rc::{Id, Shared};
57-
/// use objc2_foundation::{extern_class, NSObject};
57+
/// use objc2::{extern_class, msg_send_id};
5858
/// #
5959
/// # #[cfg(feature = "gnustep-1-7")]
6060
/// # unsafe { objc2::__gnustep_hack::get_class_to_force_linkage() };
@@ -78,7 +78,8 @@
7878
/// declared previously to specify as its superclass.
7979
///
8080
/// ```
81-
/// use objc2_foundation::{extern_class, NSObject};
81+
/// use objc2::extern_class;
82+
/// use objc2::foundation::NSObject;
8283
/// #
8384
/// # extern_class! {
8485
/// # #[derive(PartialEq, Eq, Hash)]
@@ -93,7 +94,7 @@
9394
/// }
9495
/// ```
9596
///
96-
/// See the source code of `objc2_foundation` in general for more examples.
97+
/// See the source code of `objc2::foundation` in general for more examples.
9798
#[doc(alias = "@interface")]
9899
#[macro_export]
99100
macro_rules! extern_class {

objc2/src/macros/ns_string.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ impl CachedNSString {
236236
}
237237
}
238238

239-
/// Creates an [`NSString`][`crate::NSString`] from a static string.
239+
/// Creates an [`NSString`][`crate::foundation::NSString`] from a static string.
240240
///
241241
/// Currently only supported on Apple targets.
242242
///
@@ -247,7 +247,8 @@ impl CachedNSString {
247247
/// the argument, and produces a `&'static NSString`:
248248
///
249249
/// ```
250-
/// use objc2_foundation::{ns_string, NSString};
250+
/// use objc2::ns_string;
251+
/// use objc2::foundation::NSString;
251252
/// # #[cfg(feature = "gnustep-1-7")]
252253
/// # unsafe { objc2::__gnustep_hack::get_class_to_force_linkage() };
253254
/// let hello: &'static NSString = ns_string!("hello");
@@ -266,7 +267,7 @@ impl CachedNSString {
266267
/// string to the most efficient encoding, you don't have to do anything!
267268
///
268269
/// ```
269-
/// # use objc2_foundation::ns_string;
270+
/// # use objc2::ns_string;
270271
/// # #[cfg(feature = "gnustep-1-7")]
271272
/// # unsafe { objc2::__gnustep_hack::get_class_to_force_linkage() };
272273
/// let hello_ru = ns_string!("Привет");
@@ -284,7 +285,7 @@ impl CachedNSString {
284285
/// expect:
285286
///
286287
/// ```
287-
/// # use objc2_foundation::ns_string;
288+
/// # use objc2::ns_string;
288289
/// # #[cfg(feature = "gnustep-1-7")]
289290
/// # unsafe { objc2::__gnustep_hack::get_class_to_force_linkage() };
290291
/// let example = ns_string!("example\0");

0 commit comments

Comments
 (0)