@@ -14,10 +14,9 @@ use core::mem::ManuallyDrop;
1414use core:: ptr;
1515use core:: sync:: atomic:: { AtomicPtr , Ordering } ;
1616
17- use objc2:: rc:: Id ;
18- use objc2:: runtime:: Class ;
19-
2017use crate :: foundation:: NSString ;
18+ use crate :: rc:: Id ;
19+ use crate :: runtime:: Class ;
2120
2221// This is defined in CoreFoundation, but we don't emit a link attribute
2322// here because it is already linked via Foundation.
@@ -237,7 +236,7 @@ impl CachedNSString {
237236 }
238237}
239238
240- /// Creates an [`NSString`][`crate::NSString`] from a static string.
239+ /// Creates an [`NSString`][`crate::foundation:: NSString`] from a static string.
241240///
242241/// Currently only supported on Apple targets.
243242///
@@ -248,7 +247,8 @@ impl CachedNSString {
248247/// the argument, and produces a `&'static NSString`:
249248///
250249/// ```
251- /// use objc2_foundation::{ns_string, NSString};
250+ /// use objc2::ns_string;
251+ /// use objc2::foundation::NSString;
252252/// # #[cfg(feature = "gnustep-1-7")]
253253/// # unsafe { objc2::__gnustep_hack::get_class_to_force_linkage() };
254254/// let hello: &'static NSString = ns_string!("hello");
@@ -267,7 +267,7 @@ impl CachedNSString {
267267/// string to the most efficient encoding, you don't have to do anything!
268268///
269269/// ```
270- /// # use objc2_foundation ::ns_string;
270+ /// # use objc2 ::ns_string;
271271/// # #[cfg(feature = "gnustep-1-7")]
272272/// # unsafe { objc2::__gnustep_hack::get_class_to_force_linkage() };
273273/// let hello_ru = ns_string!("Привет");
@@ -285,7 +285,7 @@ impl CachedNSString {
285285/// expect:
286286///
287287/// ```
288- /// # use objc2_foundation ::ns_string;
288+ /// # use objc2 ::ns_string;
289289/// # #[cfg(feature = "gnustep-1-7")]
290290/// # unsafe { objc2::__gnustep_hack::get_class_to_force_linkage() };
291291/// let example = ns_string!("example\0");
@@ -305,7 +305,7 @@ impl CachedNSString {
305305/// Because of that, this should be preferred over [`NSString::from_str`]
306306/// where possible.
307307///
308- /// [`NSString::from_str`]: crate::NSString::from_str
308+ /// [`NSString::from_str`]: crate::foundation:: NSString::from_str
309309#[ macro_export]
310310macro_rules! ns_string {
311311 ( $s: expr) => { {
@@ -354,7 +354,7 @@ macro_rules! __ns_string_inner {
354354 // The full UTF-16 contents along with the written length.
355355 const UTF16_FULL : ( & [ u16 ; $inp. len( ) ] , usize ) = {
356356 let mut out = [ 0u16 ; $inp. len( ) ] ;
357- let mut iter = $crate:: __string_macro :: EncodeUtf16Iter :: new( $inp) ;
357+ let mut iter = $crate:: foundation :: __ns_string :: EncodeUtf16Iter :: new( $inp) ;
358358 let mut written = 0 ;
359359
360360 while let Some ( ( state, chars) ) = iter. next( ) {
@@ -395,17 +395,17 @@ macro_rules! __ns_string_inner {
395395 // The section is the same as what clang sets, see:
396396 // https://github.com/llvm/llvm-project/blob/release/13.x/clang/lib/CodeGen/CodeGenModule.cpp#L5243
397397 #[ link_section = "__DATA,__cfstring" ]
398- static CFSTRING : $crate:: __string_macro :: CFConstString = unsafe {
399- if $crate:: __string_macro :: is_ascii_no_nul( $inp) {
398+ static CFSTRING : $crate:: foundation :: __ns_string :: CFConstString = unsafe {
399+ if $crate:: foundation :: __ns_string :: is_ascii_no_nul( $inp) {
400400 // This is technically an optimization (UTF-16 strings are
401401 // always valid), but it's a fairly important one!
402- $crate:: __string_macro :: CFConstString :: new_ascii(
403- & $crate:: __string_macro :: __CFConstantStringClassReference,
402+ $crate:: foundation :: __ns_string :: CFConstString :: new_ascii(
403+ & $crate:: foundation :: __ns_string :: __CFConstantStringClassReference,
404404 & ASCII ,
405405 )
406406 } else {
407- $crate:: __string_macro :: CFConstString :: new_utf16(
408- & $crate:: __string_macro :: __CFConstantStringClassReference,
407+ $crate:: foundation :: __ns_string :: CFConstString :: new_utf16(
408+ & $crate:: foundation :: __ns_string :: __CFConstantStringClassReference,
409409 & UTF16 ,
410410 )
411411 }
@@ -418,7 +418,7 @@ macro_rules! __ns_string_inner {
418418#[ macro_export]
419419macro_rules! __ns_string_inner {
420420 ( $inp: ident) => { {
421- use $crate:: __string_macro :: CachedNSString ;
421+ use $crate:: foundation :: __ns_string :: CachedNSString ;
422422 static CACHED_NSSTRING : CachedNSString = CachedNSString :: new( ) ;
423423 CACHED_NSSTRING . get( $inp)
424424 } } ;
@@ -508,7 +508,7 @@ mod tests {
508508 "\0 " ,
509509 "\0 \x01 \x02 \x03 \x04 \x05 \x06 \x07 \x08 \x09 " ,
510510 // "\u{feff}", // TODO
511- include_str!( "ns_string .rs" ) ,
511+ include_str!( "__ns_string .rs" ) ,
512512 }
513513 }
514514
0 commit comments