#[repr(C)]pub struct NSString {
pub ptr: ShareId<Object>,
/* private fields */
}
Expand description
This is a mapping to the Objective-C NSString class.
Fields§
§ptr: ShareId<Object>
The raw pointer to the Objective-C object.
Implementations§
Source§impl NSString
impl NSString
Sourcepub fn init(&mut self) -> Self
pub fn init(&mut self) -> Self
Returns an initialized NSString object that contains no characters.
Sourcepub fn init_with_bytes_length_encoding(
&mut self,
bytes: *const c_void,
len: UInt,
encoding: Encoding,
) -> Self
pub fn init_with_bytes_length_encoding( &mut self, bytes: *const c_void, len: UInt, encoding: Encoding, ) -> Self
Returns an initialized NSString object containing a given number of bytes from a given buffer of bytes interpreted in a given encoding.
§Arguments
-
bytes
- A buffer of bytes interpreted in the encoding specified by encoding. -
len
- The number of bytes to use from bytes. -
encoding
- The character encoding applied to bytes. For possible values, see NSStringEncoding.
§Returns
An initialized NSString object containing length bytes from bytes interpreted using the encoding encoding. The returned object may be different from the original receiver.
Sourcepub fn init_with_bytes_no_copy_length_encoding_free_when_done(
&mut self,
bytes: *mut c_void,
len: UInt,
encoding: Encoding,
free_buffer: bool,
) -> Self
pub fn init_with_bytes_no_copy_length_encoding_free_when_done( &mut self, bytes: *mut c_void, len: UInt, encoding: Encoding, free_buffer: bool, ) -> Self
Returns an initialized NSString object that contains a given number of bytes from a given buffer of bytes interpreted in a given encoding, and optionally frees the buffer.
§Arguments
bytes
- A buffer of bytes interpreted in the encoding specified by encoding.len
- The number of bytes to use from bytes.encoding
- The character encoding applied to bytes. For possible values, see NSStringEncoding.free_buffer
- If YES, bytes is freed after use.
§Returns
An initialized NSString object containing length bytes from bytes interpreted using the encoding encoding. The returned object may be different from the original receiver.
Sourcepub fn init_with_characters_length(
&mut self,
characters: *const unichar,
len: UInt,
) -> Self
pub fn init_with_characters_length( &mut self, characters: *const unichar, len: UInt, ) -> Self
Returns an initialized NSString object that contains a given number of characters from a given C array of UTF-16 code units.
§Arguments
characters
- A C array of UTF-16 code units; the value must not be NULL.length
- A C array of UTF-16 code units; the value must not be NULL.
§Returns
An initialized NSString object containing length characters from characters.
Sourcepub fn init_with_characters_no_copy_length_free_when_done(
&mut self,
characters: unichar,
length: UInt,
free_buffer: bool,
) -> Self
pub fn init_with_characters_no_copy_length_free_when_done( &mut self, characters: unichar, length: UInt, free_buffer: bool, ) -> Self
Returns an initialized NSString object that contains a given number of characters from a given C array of UTF-16 code units.
§Arguments
characters
- A C array of UTF-16 code units; the value must not be NULL.length
- A C array of UTF-16 code units; the value must not be NULL.free_buffer
- If YES, characters is freed after use.
§Returns
An initialized NSString object containing length characters from characters.
Sourcepub fn init_with_string<S>(&mut self, s: S) -> Self
pub fn init_with_string<S>(&mut self, s: S) -> Self
Sourcepub fn init_with_cstring_encoding(
&mut self,
c_str: *const c_char,
encoding: Encoding,
) -> Self
pub fn init_with_cstring_encoding( &mut self, c_str: *const c_char, encoding: Encoding, ) -> Self
Returns an NSString object initialized using the characters in a given C array, interpreted according to a given encoding.
§Arguments
c_str
- A C array of bytes.encoding
- The encoding to use to interpret c_str. For possible values, seeNSStringEncoding
.
§Returns
An NSString object initialized using the characters in c_str, interpreted according to encoding.
Sourcepub fn init_with_utf8_string(&mut self, c_str: *const c_char) -> Self
pub fn init_with_utf8_string(&mut self, c_str: *const c_char) -> Self
Sourcepub fn init_with_data_encoding(
&mut self,
data: NSData,
encoding: Encoding,
) -> Self
pub fn init_with_data_encoding( &mut self, data: NSData, encoding: Encoding, ) -> Self
Returns an NSString object initialized by converting given data into UTF-16 code units using a given encoding.
§Arguments
data
- The data to convert into UTF-16 code units.encoding
- The encoding to use to interpret data. For possible values, seeNSStringEncoding
.
§Returns
An NSString object initialized by converting data into UTF-16 code units using encoding.
Sourcepub fn localized_user_notification_string_for_key_arguments<T>(
key: NSString,
arguments: NSArray<T>,
) -> NSStringwhere
T: PNSObject,
pub fn localized_user_notification_string_for_key_arguments<T>(
key: NSString,
arguments: NSArray<T>,
) -> NSStringwhere
T: PNSObject,
Returns a localized string intended for display in a notification alert.
§Arguments
key
- The key to use when looking up the string in the app’s Localizable.strings file.arguments
- An array of values to substitute for escaped characters in the string.
Sourcepub fn string_with_characters_length(
characters: *const unichar,
length: UInt,
) -> Self
pub fn string_with_characters_length( characters: *const unichar, length: UInt, ) -> Self
Returns a string containing a given number of characters taken from a given C array of UTF-16 code units.
§Arguments
characters
- A C array of UTF-16 code units; the value must not be NULL.length
- A C array of UTF-16 code units; the value must not be NULL.
§Returns
An NSString object containing length characters from characters.
Sourcepub fn string_with_string(s: NSString) -> Self
pub fn string_with_string(s: NSString) -> Self
Sourcepub fn string_with_cstring_encoding(
c_str: *const c_char,
encoding: Encoding,
) -> Self
pub fn string_with_cstring_encoding( c_str: *const c_char, encoding: Encoding, ) -> Self
Returns a string containing the bytes in a given C array, interpreted according to a given encoding.
§Arguments
c_str
- A C array of bytes.encoding
- The encoding to use to interpret c_str. For possible values, seeNSStringEncoding
.
§Returns
An NSString object containing the bytes in c_str, interpreted according to encoding.
Sourcepub fn string_with_utf8_string(c_str: *const c_char) -> Self
pub fn string_with_utf8_string(c_str: *const c_char) -> Self
Sourcepub fn string_with_contents_of_file_encoding(
path: &NSString,
enc: Encoding,
) -> Result<Self, NSError>
pub fn string_with_contents_of_file_encoding( path: &NSString, enc: Encoding, ) -> Result<Self, NSError>
Returns a string created by reading data from the file at a given path interpreted using a given encoding.
Sourcepub fn init_with_contents_of_file_encoding(
&mut self,
path: &NSString,
enc: Encoding,
) -> Result<Self, NSError>
pub fn init_with_contents_of_file_encoding( &mut self, path: &NSString, enc: Encoding, ) -> Result<Self, NSError>
Returns an NSString
object initialized by reading data from the file at a given path using a given encoding.
Sourcepub fn string_with_contents_of_file_used_encoding(
path: &NSString,
enc: Encoding,
) -> Result<Self, NSError>
pub fn string_with_contents_of_file_used_encoding( path: &NSString, enc: Encoding, ) -> Result<Self, NSError>
Returns an NSString
object initialized by reading data from the file at a given path using a given encoding.
Sourcepub fn init_with_contents_of_file_used_encoding(
&mut self,
path: &NSString,
enc: Encoding,
) -> Result<Self, NSError>
pub fn init_with_contents_of_file_used_encoding( &mut self, path: &NSString, enc: Encoding, ) -> Result<Self, NSError>
Returns a string created by reading data from the file at a given path and returns by reference the encoding used to interpret the file.
Sourcepub fn string_with_contents_of_url_encoding(
path: &NSURL,
enc: Encoding,
) -> Result<Self, NSError>
pub fn string_with_contents_of_url_encoding( path: &NSURL, enc: Encoding, ) -> Result<Self, NSError>
Returns a string created by reading data from a given URL interpreted using a given encoding.
Sourcepub fn init_with_contents_of_url_encoding(
&mut self,
path: &NSURL,
enc: Encoding,
) -> Result<Self, NSError>
pub fn init_with_contents_of_url_encoding( &mut self, path: &NSURL, enc: Encoding, ) -> Result<Self, NSError>
Returns an NSString
object initialized by reading data from a given URL interpreted using a given encoding.
Sourcepub fn string_with_contents_of_url_used_encoding(
path: &NSURL,
enc: Encoding,
) -> Result<Self, NSError>
pub fn string_with_contents_of_url_used_encoding( path: &NSURL, enc: Encoding, ) -> Result<Self, NSError>
Returns a string created by reading data from a given URL and returns by reference the encoding used to interpret the data.
Sourcepub fn init_with_contents_of_url_used_encoding(
&mut self,
path: &NSURL,
enc: Encoding,
) -> Result<Self, NSError>
pub fn init_with_contents_of_url_used_encoding( &mut self, path: &NSURL, enc: Encoding, ) -> Result<Self, NSError>
Returns an NSString
object initialized by reading data from a given URL and returns by reference the encoding used to interpret the data.
Sourcepub fn length_of_bytes_using_encoding(&self, enc: Encoding) -> UInt
pub fn length_of_bytes_using_encoding(&self, enc: Encoding) -> UInt
Returns the number of bytes required to store the receiver in a given encoding.
§Arguments
enc
- The encoding for which to determine the receiver’s length.
§Returns
The number of bytes required to store the receiver in the encoding enc in a non-external representation. The length does not include space for a terminating NULL character. Returns 0 if the specified encoding cannot be used to convert the receiver or if the amount of memory required for storing the results of the encoding conversion would exceed NSIntegerMax.
Sourcepub fn maximum_length_of_bytes_using_encoding(&self, enc: Encoding) -> Int
pub fn maximum_length_of_bytes_using_encoding(&self, enc: Encoding) -> Int
Returns the maximum number of bytes needed to store the receiver in a given encoding.
§Arguments
enc
- The encoding for which to determine the receiver’s length.
§Returns
The maximum number of bytes needed to store the receiver in encoding in a non-external representation. The length does not include space for a terminating NULL character. Returns 0 if the amount of memory required for storing the results of the encoding conversion would exceed NSIntegerMax.
Sourcepub fn character_at_index(&self, index: UInt) -> char
pub fn character_at_index(&self, index: UInt) -> char
Sourcepub fn get_characters_range(&self, buffer: *mut unichar, range: NSRange)
pub fn get_characters_range(&self, buffer: *mut unichar, range: NSRange)
Copies characters from a given range in the receiver into a given buffer.
§Arguments
buffer
- Upon return, contains the characters from the receiver. buffer must be large enough to contain the characters in the range aRange (aRange.length*sizeof(unichar)).range
- The range of characters to copy.
Sourcepub fn get_bytes_max_length_used_length_encoding_options_range_remaining_range(
&self,
buffer: *mut c_void,
max_length: Int,
used_length: *mut Int,
encoding: Encoding,
options: NSStringEncodingConversionOptions,
range: NSRange,
remaining_range: NSRange,
) -> bool
pub fn get_bytes_max_length_used_length_encoding_options_range_remaining_range( &self, buffer: *mut c_void, max_length: Int, used_length: *mut Int, encoding: Encoding, options: NSStringEncodingConversionOptions, range: NSRange, remaining_range: NSRange, ) -> bool
Gets a given range of characters as bytes in a specified encoding.
§Arguments
buffer
- Upon return, contains the bytes from the receiver. buffer must be large enough to contain the bytes in the range aRange (aRange.length*sizeof(char)).- `maxLength - The maximum number of bytes to get.
usedLength
- Upon return, contains the actual number of bytes retrieved.encoding
- The encoding to use to interpret the bytes. For possible values, seeNSStringEncoding
.options
- The options to use for converting the receiver into the specified encoding. For possible values, seeNSStringEncodingConversionOptions
.range
- The range of characters to get.remainingRange
- Upon return, contains a range containing the remaining characters.
Sourcepub fn c_string_using_encoding(&self, encoding: Encoding) -> *const c_char
pub fn c_string_using_encoding(&self, encoding: Encoding) -> *const c_char
Returns a representation of the string as a C string using a given encoding.
§Arguments
encoding
- The encoding to use to interpret the receiver. For possible values, seeNSStringEncoding
.
§Returns
A pointer to a C string containing the receiver. The pointer is owned by the string, and must not be freed by the caller.
Sourcepub fn get_cstring_max_length_encoding(
&self,
buffer: *mut c_char,
max_length: UInt,
encoding: Encoding,
) -> bool
pub fn get_cstring_max_length_encoding( &self, buffer: *mut c_char, max_length: UInt, encoding: Encoding, ) -> bool
Returns a representation of the string as a C string.
§Arguments
buffer
- Upon return, contains the characters from the receiver. buffer must be large enough to contain the characters in the receiver.maxLength
- The maximum number of bytes to write into buffer.encoding
- The encoding to use to interpret the receiver. For possible values, seeNSStringEncoding
.
§Returns
true
if the operation was successful, otherwise false
. Returns false
if conversion is not possible due to encoding errors or if buffer is too small.
Sourcepub fn utf8_string(&self) -> *const c_char
pub fn utf8_string(&self) -> *const c_char
A null-terminated UTF8 representation of the string.
Sourcepub fn case_insensitive_compare<S>(&self, string: S) -> NSComparisonResultwhere
S: INSString,
pub fn case_insensitive_compare<S>(&self, string: S) -> NSComparisonResultwhere
S: INSString,
Returns the result of invoking compare:options: with NSCaseInsensitiveSearch as the only option.
§Arguments
string
- The string to compare.
§Returns
Returns an ComparisonResult
value that indicates the lexical ordering.
OrderedAscending
the receiver precedes string
in lexical ordering,
OrderedSame
the receiver and string
are equivalent in lexical value,
and OrderedDescending
if the receiver follows string
.
Sourcepub fn localized_case_insensitive_compare<S>(
&self,
string: S,
) -> NSComparisonResultwhere
S: INSString,
pub fn localized_case_insensitive_compare<S>(
&self,
string: S,
) -> NSComparisonResultwhere
S: INSString,
Compares the string with a given string using a case-insensitive, localized, comparison.
§Arguments
string
- The string to compare.
§Returns
Returns an ComparisonResult
value that indicates the lexical ordering.
OrderedAscending
the receiver precedes string
in lexical ordering,
OrderedSame
the receiver and string
are equivalent in lexical value,
and OrderedDescending
if the receiver follows string
Sourcepub fn compare<S>(&self, string: S) -> NSComparisonResultwhere
S: INSString,
pub fn compare<S>(&self, string: S) -> NSComparisonResultwhere
S: INSString,
Returns the result of invoking compare:options:range: with no options and the receiver’s full extent as the range.
§Arguments
string
- The string with which to compare the receiver.
§Safety
This value must not be nil. If this value is nil, the behavior is undefined and may change in future versions of macOS.
§Returns
Returns an ComparisonResult
value that indicates the lexical ordering.
OrderedAscending
the receiver precedes string
in lexical ordering,
OrderedSame
the receiver and string
are equivalent in lexical value,
and OrderedDescending
if the receiver follows string
Sourcepub fn localized_compare<S>(&self, string: S) -> NSComparisonResultwhere
S: INSString,
pub fn localized_compare<S>(&self, string: S) -> NSComparisonResultwhere
S: INSString,
Returns the result of invoking compare:options:range: with no options and the receiver’s full extent as the range.
§Arguments
string
- The string with which to compare the receiver.
Returns an ComparisonResult
value that indicates the lexical ordering.
OrderedAscending
the receiver precedes string
in lexical ordering,
OrderedSame
the receiver and string
are equivalent in lexical value,
and OrderedDescending
if the receiver follows string
Sourcepub fn compare_options<S>(
&self,
string: S,
mask: NSStringCompareOptions,
) -> NSComparisonResultwhere
S: INSString,
pub fn compare_options<S>(
&self,
string: S,
mask: NSStringCompareOptions,
) -> NSComparisonResultwhere
S: INSString,
Sourcepub fn compare_options_range<S>(
&self,
string: S,
mask: NSStringCompareOptions,
range: NSRange,
) -> NSComparisonResultwhere
S: INSString,
pub fn compare_options_range<S>(
&self,
string: S,
mask: NSStringCompareOptions,
range: NSRange,
) -> NSComparisonResultwhere
S: INSString,
Compares the string with the specified string using the given options.
§Arguments
string
- The string to compare.mask
- The mask to use when comparing the receiver andstring
.range
- The range of the receiver to compare.
Sourcepub fn compare_options_range_locale<S>(
&self,
string: S,
mask: NSStringCompareOptions,
range: NSRange,
locale: NSLocale,
) -> NSComparisonResultwhere
S: INSString,
pub fn compare_options_range_locale<S>(
&self,
string: S,
mask: NSStringCompareOptions,
range: NSRange,
locale: NSLocale,
) -> NSComparisonResultwhere
S: INSString,
Compares the string using the specified options and returns the lexical ordering for the range.
§Arguments
string
- The string to compare.mask
- The mask to use when comparing the receiver andstring
.range
- The range to compare.locale
- The locale to use when comparing the receiver andstring
.
§Returns
Returns an ComparisonResult
value that indicates the lexical ordering.
Sourcepub fn localized_standard_compare<S>(&self, string: S) -> NSComparisonResultwhere
S: INSString,
pub fn localized_standard_compare<S>(&self, string: S) -> NSComparisonResultwhere
S: INSString,
Sourcepub fn has_prefix<S>(&self, prefix: S) -> boolwhere
S: INSString,
pub fn has_prefix<S>(&self, prefix: S) -> boolwhere
S: INSString,
Sourcepub fn has_suffix<S>(&self, suffix: S) -> boolwhere
S: INSString,
pub fn has_suffix<S>(&self, suffix: S) -> boolwhere
S: INSString,
Sourcepub fn is_equal_to_string<S>(&self, string: S) -> boolwhere
S: INSString,
pub fn is_equal_to_string<S>(&self, string: S) -> boolwhere
S: INSString,
Sourcepub fn string_by_appending_string<S>(&self, string: S) -> NSStringwhere
S: INSString,
pub fn string_by_appending_string<S>(&self, string: S) -> NSStringwhere
S: INSString,
Returns a new string made by appending a given string to the receiver.
§Arguments
string
- The string to append to the receiver. This value must not be nil.
Sourcepub fn string_by_padding_to_length_with_string_starting_at_index<S>(
&self,
new_length: UInt,
pad_string: S,
starting_at: UInt,
) -> NSStringwhere
S: INSString,
pub fn string_by_padding_to_length_with_string_starting_at_index<S>(
&self,
new_length: UInt,
pad_string: S,
starting_at: UInt,
) -> NSStringwhere
S: INSString,
Returns a new string formed from the receiver by either removing characters from the end, or by appending as many occurrences as necessary of a given pad string.
§Arguments
new_length
- The number of characters to be contained in the new string.pad
- The string to use for padding.starting_at
- The index inpad_string
from which to start padding.
§Returns
A new string formed from the receiver by either removing characters from the end, or by appending as many occurrences of pad_string
as necessary.
Sourcepub fn lowercase_string(&self) -> NSString
pub fn lowercase_string(&self) -> NSString
A lowercase representation of the string.
Sourcepub fn localized_lowercase_string(&self) -> NSString
pub fn localized_lowercase_string(&self) -> NSString
Returns a version of the string with all letters converted to lowercase, taking into account the current locale.
Sourcepub fn lowercase_string_with_locale(&self, locale: NSLocale) -> NSString
pub fn lowercase_string_with_locale(&self, locale: NSLocale) -> NSString
Sourcepub fn uppercase_string(&self) -> NSString
pub fn uppercase_string(&self) -> NSString
An uppercase representation of the string.
Sourcepub fn localized_uppercase_string(&self) -> NSString
pub fn localized_uppercase_string(&self) -> NSString
Returns a version of the string with all letters converted to uppercase, taking into account the current locale.
Sourcepub fn uppercase_string_with_locale(&self, locale: NSLocale) -> NSString
pub fn uppercase_string_with_locale(&self, locale: NSLocale) -> NSString
Sourcepub fn capitalized_string(&self) -> NSString
pub fn capitalized_string(&self) -> NSString
A capitalized representation of the string.
Sourcepub fn localized_capitalized_string(&self) -> NSString
pub fn localized_capitalized_string(&self) -> NSString
Returns a capitalized representation of the receiver using the current locale.
Sourcepub fn capitalized_string_with_locale(&self, locale: NSLocale) -> NSString
pub fn capitalized_string_with_locale(&self, locale: NSLocale) -> NSString
Returns a capitalized representation of the receiver using the specified locale.
Sourcepub fn components_separated_by_string<S>(
&self,
separator: S,
) -> NSArray<NSString>where
S: INSString,
pub fn components_separated_by_string<S>(
&self,
separator: S,
) -> NSArray<NSString>where
S: INSString,
Returns an array containing substrings from the receiver that have been divided by a given separator.
Sourcepub fn components_separated_by_characters_in_set(
&self,
separator: &NSCharacterSet,
) -> NSArray<NSString>
pub fn components_separated_by_characters_in_set( &self, separator: &NSCharacterSet, ) -> NSArray<NSString>
Returns an array containing substrings from the receiver that have been divided by characters in a given set.
Sourcepub fn string_by_trimming_characters_in_set(
&self,
set: &NSCharacterSet,
) -> NSString
pub fn string_by_trimming_characters_in_set( &self, set: &NSCharacterSet, ) -> NSString
Returns a new string made by removing from both ends of the receiver characters contained in a given character set.
Sourcepub fn substring_from_index(&self, from: UInt) -> NSString
pub fn substring_from_index(&self, from: UInt) -> NSString
Returns a new string containing the characters of the receiver from the one at a given index to the end.
Sourcepub fn substring_with_range(&self, range: NSRange) -> NSString
pub fn substring_with_range(&self, range: NSRange) -> NSString
Returns a string object containing the characters of the receiver that lie within a given range.
Sourcepub fn substring_to_index(&self, to: UInt) -> NSString
pub fn substring_to_index(&self, to: UInt) -> NSString
Returns a new string containing the characters of the receiver up to, but not including, the one at a given index.
Sourcepub fn decomposed_string_with_canonical_mapping(&self) -> NSString
pub fn decomposed_string_with_canonical_mapping(&self) -> NSString
A string made by normalizing the string’s contents using the Unicode Normalization Form D.
Sourcepub fn decomposed_string_with_compatibility_mapping(&self) -> NSString
pub fn decomposed_string_with_compatibility_mapping(&self) -> NSString
A string made by normalizing the receiver’s contents using the Unicode Normalization Form KD.
Sourcepub fn precomposed_string_with_canonical_mapping(&self) -> NSString
pub fn precomposed_string_with_canonical_mapping(&self) -> NSString
A string made by normalizing the string’s contents using the Unicode Normalization Form C.
Sourcepub fn precomposed_string_with_compatibility_mapping(&self) -> NSString
pub fn precomposed_string_with_compatibility_mapping(&self) -> NSString
A string made by normalizing the receiver’s contents using the Unicode Normalization Form KC.
Sourcepub fn string_by_folding_with_options_locale(
&mut self,
options: NSStringCompareOptions,
locale: &NSLocale,
) -> NSString
pub fn string_by_folding_with_options_locale( &mut self, options: NSStringCompareOptions, locale: &NSLocale, ) -> NSString
Creates a string suitable for comparison by removing the specified character distinctions from a string.
Sourcepub fn string_by_applying_transform_reverse(
&mut self,
transform: NSStringTransform,
reverse: bool,
) -> Option<NSString>
pub fn string_by_applying_transform_reverse( &mut self, transform: NSStringTransform, reverse: bool, ) -> Option<NSString>
Returns a new string made by appending to the receiver a given string.
§Arguments
transform
- TheStringTransform
to apply.reverse
- Iftrue
, the transformation is applied in reverse.
Sourcepub fn contains_string<S>(&self, other: S) -> boolwhere
S: INSString,
pub fn contains_string<S>(&self, other: S) -> boolwhere
S: INSString,
Sourcepub fn available_string_encodings() -> *const Encoding
pub fn available_string_encodings() -> *const Encoding
Returns a zero-terminated list of the encodings string objects support in the application’s environment.
Sourcepub fn default_cstring_encoding() -> Encoding
pub fn default_cstring_encoding() -> Encoding
Returns the C-string encoding assumed for any method accepting a C string as an argument.
Sourcepub fn can_be_converted_to_encoding(&self, encoding: Encoding) -> bool
pub fn can_be_converted_to_encoding(&self, encoding: Encoding) -> bool
Returns a Boolean value that indicates whether the receiver can be converted to a given encoding without loss of information.
Sourcepub fn data_using_encoding(&self, encoding: Encoding) -> NSData
pub fn data_using_encoding(&self, encoding: Encoding) -> NSData
Returns an NSData object containing a representation of the receiver encoded using a given encoding.
Trait Implementations§
Source§impl From<NSMutableString> for NSString
impl From<NSMutableString> for NSString
Source§fn from(string: NSMutableString) -> Self
fn from(string: NSMutableString) -> Self
Source§impl From<NSString> for NSMutableString
impl From<NSString> for NSMutableString
Source§impl INSString for NSString
impl INSString for NSString
Source§fn m_init(&mut self) -> Self
fn m_init(&mut self) -> Self
Source§fn m_init_with_bytes_length_encoding(
&mut self,
bytes: *const c_void,
len: UInt,
encoding: Encoding,
) -> Self
fn m_init_with_bytes_length_encoding( &mut self, bytes: *const c_void, len: UInt, encoding: Encoding, ) -> Self
Source§fn m_init_with_bytes_no_copy_length_encoding_free_when_done(
&mut self,
bytes: *mut c_void,
len: UInt,
encoding: Encoding,
free_buffer: bool,
) -> Self
fn m_init_with_bytes_no_copy_length_encoding_free_when_done( &mut self, bytes: *mut c_void, len: UInt, encoding: Encoding, free_buffer: bool, ) -> Self
Source§fn m_init_with_characters_length(
&mut self,
characters: *const unichar,
len: UInt,
) -> Self
fn m_init_with_characters_length( &mut self, characters: *const unichar, len: UInt, ) -> Self
Source§fn m_init_with_characters_no_copy_length_free_when_done(
&mut self,
characters: unichar,
length: UInt,
free_buffer: bool,
) -> Self
fn m_init_with_characters_no_copy_length_free_when_done( &mut self, characters: unichar, length: UInt, free_buffer: bool, ) -> Self
Source§fn m_init_with_string<S>(&mut self, s: S) -> Self
fn m_init_with_string<S>(&mut self, s: S) -> Self
Source§fn m_init_with_cstring_encoding(
&mut self,
c_str: *const c_char,
encoding: Encoding,
) -> Self
fn m_init_with_cstring_encoding( &mut self, c_str: *const c_char, encoding: Encoding, ) -> Self
Source§fn m_init_with_utf8_string(&mut self, c_str: *const c_char) -> Self
fn m_init_with_utf8_string(&mut self, c_str: *const c_char) -> Self
Source§fn m_init_with_data_encoding(
&mut self,
data: NSData,
encoding: Encoding,
) -> Self
fn m_init_with_data_encoding( &mut self, data: NSData, encoding: Encoding, ) -> Self
Source§fn m_localized_user_notification_string_for_key_arguments<T>(
key: NSString,
arguments: NSArray<T>,
) -> NSStringwhere
T: PNSObject,
fn m_localized_user_notification_string_for_key_arguments<T>(
key: NSString,
arguments: NSArray<T>,
) -> NSStringwhere
T: PNSObject,
Source§fn m_string_with_characters_length(
characters: *const unichar,
length: UInt,
) -> Self
fn m_string_with_characters_length( characters: *const unichar, length: UInt, ) -> Self
Source§fn m_string_with_string(s: NSString) -> Self
fn m_string_with_string(s: NSString) -> Self
Source§fn m_string_with_cstring_encoding(
c_str: *const c_char,
encoding: Encoding,
) -> Self
fn m_string_with_cstring_encoding( c_str: *const c_char, encoding: Encoding, ) -> Self
Source§fn m_string_with_utf8_string(c_str: *const c_char) -> Self
fn m_string_with_utf8_string(c_str: *const c_char) -> Self
Source§fn m_string_with_contents_of_file_encoding(
path: &NSString,
enc: Encoding,
) -> Result<Self, NSError>
fn m_string_with_contents_of_file_encoding( path: &NSString, enc: Encoding, ) -> Result<Self, NSError>
Source§fn m_init_with_contents_of_file_encoding(
&mut self,
path: &NSString,
enc: Encoding,
) -> Result<Self, NSError>
fn m_init_with_contents_of_file_encoding( &mut self, path: &NSString, enc: Encoding, ) -> Result<Self, NSError>
NSString
object initialized by reading data from the file at a given path using a given encoding.Source§fn m_string_with_contents_of_file_used_encoding(
path: &NSString,
enc: Encoding,
) -> Result<Self, NSError>
fn m_string_with_contents_of_file_used_encoding( path: &NSString, enc: Encoding, ) -> Result<Self, NSError>
NSString
object initialized by reading data from the file at a given path using a given encoding.Source§fn m_init_with_contents_of_file_used_encoding(
&mut self,
path: &NSString,
enc: Encoding,
) -> Result<Self, NSError>
fn m_init_with_contents_of_file_used_encoding( &mut self, path: &NSString, enc: Encoding, ) -> Result<Self, NSError>
Source§fn m_string_with_contents_of_url_encoding(
path: &NSURL,
enc: Encoding,
) -> Result<Self, NSError>
fn m_string_with_contents_of_url_encoding( path: &NSURL, enc: Encoding, ) -> Result<Self, NSError>
Source§fn m_init_with_contents_of_url_encoding(
&mut self,
path: &NSURL,
enc: Encoding,
) -> Result<Self, NSError>
fn m_init_with_contents_of_url_encoding( &mut self, path: &NSURL, enc: Encoding, ) -> Result<Self, NSError>
NSString
object initialized by reading data from a given URL interpreted using a given encoding.Source§fn m_string_with_contents_of_url_used_encoding(
path: &NSURL,
enc: Encoding,
) -> Result<Self, NSError>
fn m_string_with_contents_of_url_used_encoding( path: &NSURL, enc: Encoding, ) -> Result<Self, NSError>
Source§fn m_init_with_contents_of_url_used_encoding(
&mut self,
path: &NSURL,
enc: Encoding,
) -> Result<Self, NSError>
fn m_init_with_contents_of_url_used_encoding( &mut self, path: &NSURL, enc: Encoding, ) -> Result<Self, NSError>
NSString
object initialized by reading data from a given URL and returns by reference the encoding used to interpret the data.