Struct fruity__bbqsrc::foundation::NSString [−][src]
#[repr(C)]pub struct NSString<'data>(_);
Expand description
A static, plain-text Unicode string object.
See documentation.
Implementations
Getting available encodings.
Returns a slice containing all supported encodings.
The first time this is called, one pass is done to determine the length of the slice. The slice is then cached for subsequent calls.
Returns an iterator over all supported encodings.
Unlike available_encodings_slice
,
this is implemented lazily and does not perform caching.
Returns a pointer to a buffer containing all supported encodings.
See documentation.
Returns the number of supported encodings.
The first time this is called, one pass is done to determine the number
of encodings. The count is then cached for subsequent calls. This shares
the same cache as
available_encodings_slice
.
Creates an immutable string object without copying a slice.
Safety
The returned string object or its clones must not outlive the referenced string slice.
Returns a string representation of range
.
See documentation.
Returns a copy of this object using
NSCopying
.
See documentation.
Returns a copy of this object using
NSMutableCopying
.
See documentation.
Getting contents as UTF-8.
Returns a null-terminated UTF-8 representation of self
, or null
if the internal storage of self
does not allow this to be returned
efficiently.
Unlike to_utf8_ptr
, this does not allocate
and construct a new UTF-8 C string if self
does not represent one.
This is retrieved using
CFStringGetCStringPtr
and
kCFStringEncodingUTF8
.
Returns a null-terminated UTF-8 representation of self
.
This C string is a pointer to a structure inside self
,
which may have a lifetime shorter than the string object and will
certainly not have a longer lifetime. Therefore, you should copy the C
string if it needs to be stored outside of the memory context in which
you use this property.
This is retrieved using
-[NSString UTF8String]
.
Returns the contents of self
as a native UTF-8 string slice, or None
if the internal storage of self
does not allow this to be returned
efficiently.
Unlike to_str
, this does not allocate and
construct a new UTF-8 C string if self
does not represent one.
Safety
You must ensure that self
is not mutated during the lifetime of the
returned string slice.
Returns the contents of self
as a native UTF-8 string slice.
This internally uses to_utf8_ptr
. See its
documentation for details.
Safety
The lifetime of the returned string slice may be shorter than this
object. Therefore, long use cases should copy the bytes of the returned
string slice or use to_string
.
Returns the contents of self
as a native UTF-8 string slice ending
with a 0 byte, or None
if the internal storage of self
does not
allow this to be returned efficiently.
Unlike to_str_with_nul
, this does not
allocate and construct a new UTF-8 C string if self
does not represent
one.
Safety
You must ensure that self
is not mutated during the lifetime of the
returned string slice.
Returns the contents of self
as a native UTF-8 string slice ending
with a 0 byte.
This internally uses to_utf8_ptr
. See its
documentation for details.
Safety
The lifetime of the returned string slice may be shorter than this
object. Therefore, long use cases should copy the bytes of the returned
string slice or use to_string_with_nul
.
Returns the contents of self
as a native UTF-8 string buffer.
This internally uses to_utf8_ptr
. See its
documentation for details.
Performance Considerations
Because of how
-[NSString UTF8String]
works, this method will likely allocate twice as much memory needed for
the length of the resulting buffer. If your use case is short-lived
enough, consider using to_str
to save memory and time.
Returns the contents of self
as a native UTF-8 string buffer ending
with a 0 byte.
This internally uses to_utf8_ptr
. See its
documentation for details.
Performance Considerations
Because of how
-[NSString UTF8String]
works, this method will likely allocate twice as much memory needed for
the length of the resulting buffer. If your use case is short-lived
enough, consider using to_str_with_nul
to
save memory and time.
Getting contents as UTF-16.
Returns a pointer to the UTF-16 representation of self
, or null if the
internal storage of self
does not allow this to be returned
efficiently.
This is retrieved using
CFStringGetCharactersPtr
See as_utf8_ptr
for the UTF-8 equivalent.
Returns the number of UTF-16 code units in self
.
See documentation.
Returns a selector with self
as its name.
If self
cannot be converted to UTF-8 (this should be only due to
insufficient memory), this returns None
.
See documentation.
Compares the string and a given string using no options.
See documentation.
Compares the string and a given string using a localized comparison.
See documentation.
Compares the string with a given string using NSCaseInsensitiveSearch
.
See documentation.
Compares the string with a given string using a case-insensitive, localized, comparison.
See documentation.
Compares strings as sorted by the Finder.
This method should be used whenever file names or other strings are presented in lists and tables where Finder-like sorting is appropriate. The exact sorting behavior of this method is different under different locales and may be changed in future releases. This method uses the current locale.
See documentation.
Returns true
if the given string matches the beginning characters of
self
.
See documentation.
Returns true
if the given string matches the ending characters of this
string.
See documentation.
Methods from Deref<Target = NSObject<'data>>
Returns this object’s reference count.
This method is only useful for debugging certain objects.
See documentation.
Returns true
if this object implements or inherits a method that can
respond to a specified message.
See documentation.
Returns true
if this object is an instance or subclass of class
.
See documentation
Returns true
if this object is an instance of class
.
See documentation
Returns an integer that can be used as a table address in a hash table structure.
See documentation.
Returns a copy of this object using
NSCopying
.
See documentation.
Returns a copy of this object using
NSMutableCopying
.
See documentation.
Returns a string that describes the contents of this object.
See documentation
Returns a string that describes the contents of the receiver for presentation in the debugger.
See documentation
Trait Implementations
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Casts self
into a type-erased Objective-C object.
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Auto Trait Implementations
impl<'data> RefUnwindSafe for NSString<'data>
impl<'data> UnwindSafe for NSString<'data>