pub struct CFMutableString { /* private fields */ }Expand description
This is toll-free bridged with NSMutableString.
Implementations§
Source§impl CFMutableString
impl CFMutableString
pub fn new( alloc: Option<&CFAllocator>, max_length: CFIndex, ) -> Option<CFRetained<CFMutableString>>
CFString only.pub fn new_copy( alloc: Option<&CFAllocator>, max_length: CFIndex, the_string: Option<&CFString>, ) -> Option<CFRetained<CFMutableString>>
CFString only.Sourcepub unsafe fn with_external_characters_no_copy(
alloc: Option<&CFAllocator>,
chars: *mut u16,
num_chars: CFIndex,
capacity: CFIndex,
external_characters_allocator: Option<&CFAllocator>,
) -> Option<CFRetained<CFMutableString>>
Available on crate feature CFString only.
pub unsafe fn with_external_characters_no_copy( alloc: Option<&CFAllocator>, chars: *mut u16, num_chars: CFIndex, capacity: CFIndex, external_characters_allocator: Option<&CFAllocator>, ) -> Option<CFRetained<CFMutableString>>
CFString only.§Safety
allocmight not allowNone.charsmust be a valid pointer.external_characters_allocatormight not allowNone.
Source§impl CFMutableString
impl CFMutableString
Sourcepub fn append(
the_string: Option<&CFMutableString>,
appended_string: Option<&CFString>,
)
Available on crate feature CFString only.
pub fn append( the_string: Option<&CFMutableString>, appended_string: Option<&CFString>, )
CFString only.- MutableString functions **
Sourcepub unsafe fn append_characters(
the_string: Option<&CFMutableString>,
chars: *const u16,
num_chars: CFIndex,
)
Available on crate feature CFString only.
pub unsafe fn append_characters( the_string: Option<&CFMutableString>, chars: *const u16, num_chars: CFIndex, )
CFString only.§Safety
the_stringmight not allowNone.charsmust be a valid pointer.
Sourcepub unsafe fn append_pascal_string(
the_string: Option<&CFMutableString>,
p_str: *const c_char,
encoding: CFStringEncoding,
)
Available on crate feature CFString only.
pub unsafe fn append_pascal_string( the_string: Option<&CFMutableString>, p_str: *const c_char, encoding: CFStringEncoding, )
CFString only.§Safety
the_stringmight not allowNone.p_strmust be a valid pointer.
Sourcepub unsafe fn append_c_string(
the_string: Option<&CFMutableString>,
c_str: *const c_char,
encoding: CFStringEncoding,
)
Available on crate feature CFString only.
pub unsafe fn append_c_string( the_string: Option<&CFMutableString>, c_str: *const c_char, encoding: CFStringEncoding, )
CFString only.§Safety
the_stringmight not allowNone.c_strmust be a valid pointer.
Sourcepub unsafe fn insert(
str: Option<&CFMutableString>,
idx: CFIndex,
inserted_str: Option<&CFString>,
)
Available on crate feature CFString only.
pub unsafe fn insert( str: Option<&CFMutableString>, idx: CFIndex, inserted_str: Option<&CFString>, )
CFString only.§Safety
strmight not allowNone.inserted_strmight not allowNone.
Sourcepub unsafe fn delete(the_string: Option<&CFMutableString>, range: CFRange)
Available on crate feature CFString only.
pub unsafe fn delete(the_string: Option<&CFMutableString>, range: CFRange)
CFString only.§Safety
the_string might not allow None.
Sourcepub unsafe fn replace(
the_string: Option<&CFMutableString>,
range: CFRange,
replacement: Option<&CFString>,
)
Available on crate feature CFString only.
pub unsafe fn replace( the_string: Option<&CFMutableString>, range: CFRange, replacement: Option<&CFString>, )
CFString only.§Safety
the_stringmight not allowNone.replacementmight not allowNone.
pub fn replace_all( the_string: Option<&CFMutableString>, replacement: Option<&CFString>, )
CFString only.Sourcepub unsafe fn find_and_replace(
the_string: Option<&CFMutableString>,
string_to_find: Option<&CFString>,
replacement_string: Option<&CFString>,
range_to_search: CFRange,
compare_options: CFStringCompareFlags,
) -> CFIndex
Available on crate feature CFString only.
pub unsafe fn find_and_replace( the_string: Option<&CFMutableString>, string_to_find: Option<&CFString>, replacement_string: Option<&CFString>, range_to_search: CFRange, compare_options: CFStringCompareFlags, ) -> CFIndex
CFString only.§Safety
the_stringmight not allowNone.string_to_findmight not allowNone.replacement_stringmight not allowNone.
Sourcepub unsafe fn set_external_characters_no_copy(
the_string: Option<&CFMutableString>,
chars: *mut u16,
length: CFIndex,
capacity: CFIndex,
)
Available on crate feature CFString only.
pub unsafe fn set_external_characters_no_copy( the_string: Option<&CFMutableString>, chars: *mut u16, length: CFIndex, capacity: CFIndex, )
CFString only.§Safety
the_stringmight not allowNone.charsmust be a valid pointer.
Sourcepub unsafe fn pad(
the_string: Option<&CFMutableString>,
pad_string: Option<&CFString>,
length: CFIndex,
index_into_pad: CFIndex,
)
Available on crate feature CFString only.
pub unsafe fn pad( the_string: Option<&CFMutableString>, pad_string: Option<&CFString>, length: CFIndex, index_into_pad: CFIndex, )
CFString only.§Safety
the_stringmight not allowNone.pad_stringmight not allowNone.
pub fn trim( the_string: Option<&CFMutableString>, trim_string: Option<&CFString>, )
CFString only.pub fn trim_whitespace(the_string: Option<&CFMutableString>)
CFString only.pub fn lowercase( the_string: Option<&CFMutableString>, locale: Option<&CFLocale>, )
CFString and CFLocale only.pub fn uppercase( the_string: Option<&CFMutableString>, locale: Option<&CFLocale>, )
CFString and CFLocale only.pub fn capitalize( the_string: Option<&CFMutableString>, locale: Option<&CFLocale>, )
CFString and CFLocale only.Source§impl CFMutableString
impl CFMutableString
Sourcepub unsafe fn normalize(
the_string: Option<&CFMutableString>,
the_form: CFStringNormalizationForm,
)
Available on crate feature CFString only.
pub unsafe fn normalize( the_string: Option<&CFMutableString>, the_form: CFStringNormalizationForm, )
CFString only.Normalizes the string into the specified form as described in Unicode Technical Report #15.
Parameter theString: The string which is to be normalized. If this
parameter is not a valid mutable CFString, the behavior is
undefined.
Parameter theForm: The form into which the string is to be normalized.
If this parameter is not a valid CFStringNormalizationForm value,
the behavior is undefined.
§Safety
the_string might not allow None.
Sourcepub fn fold(
the_string: Option<&CFMutableString>,
the_flags: CFStringCompareFlags,
the_locale: Option<&CFLocale>,
)
Available on crate features CFString and CFLocale only.
pub fn fold( the_string: Option<&CFMutableString>, the_flags: CFStringCompareFlags, the_locale: Option<&CFLocale>, )
CFString and CFLocale only.Folds the string into the form specified by the flags. Character foldings are operations that convert any of a set of characters sharing similar semantics into a single representative from that set. This function can be used to preprocess strings that are to be compared, searched, or indexed. Note that folding does not include normalization, so it is necessary to use CFStringNormalize in addition to CFStringFold in order to obtain the effect of kCFCompareNonliteral.
Parameter theString: The string which is to be folded. If this parameter is not
a valid mutable CFString, the behavior is undefined.
Parameter theFlags: The equivalency flags which describes the character folding form.
Only those flags containing the word “insensitive” are recognized here; other flags are ignored.
Folding with kCFCompareCaseInsensitive removes case distinctions in accordance with the mapping
specified by ftp://ftp.unicode.org/Public/UNIDATA/CaseFolding.txt. Folding with
kCFCompareDiacriticInsensitive removes distinctions of accents and other diacritics. Folding
with kCFCompareWidthInsensitive removes character width distinctions by mapping characters in
the range U+FF00-U+FFEF to their ordinary equivalents.
Parameter theLocale: The locale tailoring the character folding behavior. If NULL,
it’s considered to be the system locale returned from CFLocaleGetSystem().
If non-NULL and not a valid CFLocale object, the behavior is undefined.
Methods from Deref<Target = CFString>§
Sourcepub fn length(&self) -> CFIndex
Available on crate feature CFString only.
pub fn length(&self) -> CFIndex
CFString only.- Basic accessors for the contents **
pub unsafe fn character_at_index(&self, idx: CFIndex) -> u16
CFString only.Sourcepub unsafe fn characters(&self, range: CFRange, buffer: *mut u16)
Available on crate feature CFString only.
pub unsafe fn characters(&self, range: CFRange, buffer: *mut u16)
CFString only.§Safety
buffer must be a valid pointer.
Sourcepub unsafe fn pascal_string(
&self,
buffer: *mut c_char,
buffer_size: CFIndex,
encoding: CFStringEncoding,
) -> bool
Available on crate feature CFString only.
pub unsafe fn pascal_string( &self, buffer: *mut c_char, buffer_size: CFIndex, encoding: CFStringEncoding, ) -> bool
CFString only.§Safety
buffer must be a valid pointer.
Sourcepub unsafe fn c_string(
&self,
buffer: *mut c_char,
buffer_size: CFIndex,
encoding: CFStringEncoding,
) -> bool
Available on crate feature CFString only.
pub unsafe fn c_string( &self, buffer: *mut c_char, buffer_size: CFIndex, encoding: CFStringEncoding, ) -> bool
CFString only.§Safety
buffer must be a valid pointer.
pub fn pascal_string_ptr(&self, encoding: CFStringEncoding) -> *const c_char
CFString only.pub fn c_string_ptr(&self, encoding: CFStringEncoding) -> *const c_char
CFString only.pub fn characters_ptr(&self) -> *const u16
CFString only.Sourcepub unsafe fn bytes(
&self,
range: CFRange,
encoding: CFStringEncoding,
loss_byte: u8,
is_external_representation: bool,
buffer: *mut u8,
max_buf_len: CFIndex,
used_buf_len: *mut CFIndex,
) -> CFIndex
Available on crate feature CFString only.
pub unsafe fn bytes( &self, range: CFRange, encoding: CFStringEncoding, loss_byte: u8, is_external_representation: bool, buffer: *mut u8, max_buf_len: CFIndex, used_buf_len: *mut CFIndex, ) -> CFIndex
CFString only.§Safety
buffermust be a valid pointer.used_buf_lenmust be a valid pointer.
pub fn smallest_encoding(&self) -> CFStringEncoding
CFString only.pub fn fastest_encoding(&self) -> CFStringEncoding
CFString only.Sourcepub unsafe fn file_system_representation(
&self,
buffer: *mut c_char,
max_buf_len: CFIndex,
) -> bool
Available on crate feature CFString only.
pub unsafe fn file_system_representation( &self, buffer: *mut c_char, max_buf_len: CFIndex, ) -> bool
CFString only.pub fn maximum_size_of_file_system_representation(&self) -> CFIndex
CFString only.Sourcepub unsafe fn compare_with_options_and_locale(
&self,
the_string2: Option<&CFString>,
range_to_compare: CFRange,
compare_options: CFStringCompareFlags,
locale: Option<&CFLocale>,
) -> CFComparisonResult
Available on crate features CFString and CFLocale only.
pub unsafe fn compare_with_options_and_locale( &self, the_string2: Option<&CFString>, range_to_compare: CFRange, compare_options: CFStringCompareFlags, locale: Option<&CFLocale>, ) -> CFComparisonResult
CFString and CFLocale only.§Safety
the_string2might not allowNone.localemight not allowNone.
Sourcepub unsafe fn compare_with_options(
&self,
the_string2: Option<&CFString>,
range_to_compare: CFRange,
compare_options: CFStringCompareFlags,
) -> CFComparisonResult
Available on crate feature CFString only.
pub unsafe fn compare_with_options( &self, the_string2: Option<&CFString>, range_to_compare: CFRange, compare_options: CFStringCompareFlags, ) -> CFComparisonResult
CFString only.§Safety
the_string2 might not allow None.
pub fn compare( &self, the_string2: Option<&CFString>, compare_options: CFStringCompareFlags, ) -> CFComparisonResult
CFString only.Sourcepub unsafe fn find_with_options_and_locale(
&self,
string_to_find: Option<&CFString>,
range_to_search: CFRange,
search_options: CFStringCompareFlags,
locale: Option<&CFLocale>,
result: *mut CFRange,
) -> bool
Available on crate features CFString and CFLocale only.
pub unsafe fn find_with_options_and_locale( &self, string_to_find: Option<&CFString>, range_to_search: CFRange, search_options: CFStringCompareFlags, locale: Option<&CFLocale>, result: *mut CFRange, ) -> bool
CFString and CFLocale only.§Safety
string_to_findmight not allowNone.localemight not allowNone.resultmust be a valid pointer.
Sourcepub unsafe fn find_with_options(
&self,
string_to_find: Option<&CFString>,
range_to_search: CFRange,
search_options: CFStringCompareFlags,
result: *mut CFRange,
) -> bool
Available on crate feature CFString only.
pub unsafe fn find_with_options( &self, string_to_find: Option<&CFString>, range_to_search: CFRange, search_options: CFStringCompareFlags, result: *mut CFRange, ) -> bool
CFString only.§Safety
string_to_findmight not allowNone.resultmust be a valid pointer.
pub fn find( &self, string_to_find: Option<&CFString>, compare_options: CFStringCompareFlags, ) -> CFRange
CFString only.pub fn has_prefix(&self, prefix: Option<&CFString>) -> bool
CFString only.pub fn has_suffix(&self, suffix: Option<&CFString>) -> bool
CFString only.Sourcepub unsafe fn range_of_composed_characters_at_index(
&self,
the_index: CFIndex,
) -> CFRange
Available on crate feature CFString only.
pub unsafe fn range_of_composed_characters_at_index( &self, the_index: CFIndex, ) -> CFRange
CFString only.Returns the range of the composed character sequence at the specified index.
Parameter theString: The CFString which is to be searched. If this
parameter is not a valid CFString, the behavior is
undefined.
Parameter theIndex: The index of the character contained in the
composed character sequence. If the index is
outside the index space of the string (0 to N-1 inclusive,
where N is the length of the string), the behavior is
undefined.
Returns: The range of the composed character sequence.
Sourcepub unsafe fn find_character_from_set(
&self,
the_set: Option<&CFCharacterSet>,
range_to_search: CFRange,
search_options: CFStringCompareFlags,
result: *mut CFRange,
) -> bool
Available on crate features CFString and CFCharacterSet only.
pub unsafe fn find_character_from_set( &self, the_set: Option<&CFCharacterSet>, range_to_search: CFRange, search_options: CFStringCompareFlags, result: *mut CFRange, ) -> bool
CFString and CFCharacterSet only.Query the range of the first character contained in the specified character set.
Parameter theString: The CFString which is to be searched. If this
parameter is not a valid CFString, the behavior is
undefined.
Parameter theSet: The CFCharacterSet against which the membership
of characters is checked. If this parameter is not a valid
CFCharacterSet, the behavior is undefined.
Parameter rangeToSearch: The range of characters within the string to search. If
the range location or end point (defined by the location
plus length minus 1) are outside the index space of the
string (0 to N-1 inclusive, where N is the length of the
string), the behavior is undefined. If the range length is
negative, the behavior is undefined. The range may be empty
(length 0), in which case no search is performed.
Parameter searchOptions: The bitwise-or’ed option flags to control
the search behavior. The supported options are
kCFCompareBackwards andkCFCompareAnchored.
If other option flags are specified, the behavior
is undefined.
Parameter result: The pointer to a CFRange supplied by the caller in
which the search result is stored. Note that the length
of this range can be more than 1, if for instance the
result is a composed character. If a pointer to an invalid
memory is specified, the behavior is undefined.
Returns: true, if at least a character which is a member of the character set is found and result is filled, otherwise, false.
§Safety
the_setmight not allowNone.resultmust be a valid pointer.
Sourcepub unsafe fn line_bounds(
&self,
range: CFRange,
line_begin_index: *mut CFIndex,
line_end_index: *mut CFIndex,
contents_end_index: *mut CFIndex,
)
Available on crate feature CFString only.
pub unsafe fn line_bounds( &self, range: CFRange, line_begin_index: *mut CFIndex, line_end_index: *mut CFIndex, contents_end_index: *mut CFIndex, )
CFString only.§Safety
line_begin_indexmust be a valid pointer.line_end_indexmust be a valid pointer.contents_end_indexmust be a valid pointer.
Sourcepub unsafe fn paragraph_bounds(
&self,
range: CFRange,
par_begin_index: *mut CFIndex,
par_end_index: *mut CFIndex,
contents_end_index: *mut CFIndex,
)
Available on crate feature CFString only.
pub unsafe fn paragraph_bounds( &self, range: CFRange, par_begin_index: *mut CFIndex, par_end_index: *mut CFIndex, contents_end_index: *mut CFIndex, )
CFString only.§Safety
par_begin_indexmust be a valid pointer.par_end_indexmust be a valid pointer.contents_end_indexmust be a valid pointer.
Sourcepub unsafe fn hyphenation_location_before_index(
&self,
location: CFIndex,
limit_range: CFRange,
options: CFOptionFlags,
locale: Option<&CFLocale>,
character: *mut u32,
) -> CFIndex
Available on crate features CFString and CFLocale only.
pub unsafe fn hyphenation_location_before_index( &self, location: CFIndex, limit_range: CFRange, options: CFOptionFlags, locale: Option<&CFLocale>, character: *mut u32, ) -> CFIndex
CFString and CFLocale only.Retrieve the first potential hyphenation location found before the specified location.
Parameter string: The CFString which is to be hyphenated. If this
parameter is not a valid CFString, the behavior is
undefined.
Parameter location: An index in the string. If a valid hyphen index is returned, it
will be before this index.
Parameter limitRange: The range of characters within the string to search. If
the range location or end point (defined by the location
plus length minus 1) are outside the index space of the
string (0 to N-1 inclusive, where N is the length of the
string), the behavior is undefined. If the range length is
negative, the behavior is undefined. The range may be empty
(length 0), in which case no hyphen location is generated.
Parameter options: Reserved for future use.
Parameter locale: Specifies which language’s hyphenation conventions to use.
This must be a valid locale. Hyphenation data is not available
for all locales. You can use CFStringIsHyphenationAvailableForLocale
to test for availability of hyphenation data.
Parameter character: The suggested hyphen character to insert. Pass NULL if you
do not need this information.
Returns: an index in the string where it is appropriate to insert a hyphen, if one exists; else kCFNotFound
§Safety
localemight not allowNone.charactermust be a valid pointer.
Sourcepub fn int_value(&self) -> i32
Available on crate feature CFString only.
pub fn int_value(&self) -> i32
CFString only.- Parsing non-localized numbers from strings **
pub fn double_value(&self) -> c_double
CFString only.pub fn convert_iana_char_set_name_to_encoding(&self) -> CFStringEncoding
CFString only.Sourcepub unsafe fn as_str_unchecked(&self) -> Option<&str>
Available on crate feature CFString only.
pub unsafe fn as_str_unchecked(&self) -> Option<&str>
CFString only.Get the str representation of this string if it can be
done efficiently.
Returns None if the internal storage does not allow this to be
done efficiently. Use CFString::to_string if performance is not an
issue.
§Safety
The CFString must not be mutated for the lifetime of the returned
string.
Warning: This is very difficult to ensure in generic contexts, e.g. it
cannot even be used inside Debug::fmt, since Formatter uses dyn
internally, and could thus mutate the string inside there.
Methods from Deref<Target = CFType>§
Sourcepub fn downcast_ref<T: ConcreteType>(&self) -> Option<&T>
pub fn downcast_ref<T: ConcreteType>(&self) -> Option<&T>
Attempt to downcast the type to that of type T.
This is the reference-variant. Use CFRetained::downcast if you
want to convert a retained type. See also ConcreteType for more
details on which types support being converted to.
Sourcepub fn retain_count(&self) -> usize
pub fn retain_count(&self) -> usize
Get the reference count of the object.
This function may be useful for debugging. You normally do not use this function otherwise.
Beware that some things (like CFNumbers, small CFStrings etc.) may
not have a normal retain count for optimization purposes, and can
return usize::MAX in that case.
Trait Implementations§
Source§impl AsRef<AnyObject> for CFMutableString
impl AsRef<AnyObject> for CFMutableString
Source§impl AsRef<CFMutableString> for CFMutableString
impl AsRef<CFMutableString> for CFMutableString
Source§impl AsRef<CFString> for CFMutableString
impl AsRef<CFString> for CFMutableString
Source§impl AsRef<CFType> for CFMutableString
impl AsRef<CFType> for CFMutableString
Source§impl Borrow<AnyObject> for CFMutableString
impl Borrow<AnyObject> for CFMutableString
Source§impl Borrow<CFString> for CFMutableString
impl Borrow<CFString> for CFMutableString
Source§impl Borrow<CFType> for CFMutableString
impl Borrow<CFType> for CFMutableString
Source§impl Debug for CFMutableString
impl Debug for CFMutableString
Source§impl Deref for CFMutableString
impl Deref for CFMutableString
Source§impl Hash for CFMutableString
impl Hash for CFMutableString
Source§impl Message for CFMutableString
impl Message for CFMutableString
Source§impl PartialEq for CFMutableString
impl PartialEq for CFMutableString
Source§impl RefEncode for CFMutableString
impl RefEncode for CFMutableString
Source§const ENCODING_REF: Encoding
const ENCODING_REF: Encoding
Source§impl Type for CFMutableString
impl Type for CFMutableString
Source§fn retain(&self) -> CFRetained<Self> ⓘwhere
Self: Sized,
fn retain(&self) -> CFRetained<Self> ⓘwhere
Self: Sized,
Source§fn as_concrete_TypeRef(&self) -> &Self
fn as_concrete_TypeRef(&self) -> &Self
core-foundation crate.Source§unsafe fn wrap_under_get_rule(ptr: *const Self) -> CFRetained<Self> ⓘwhere
Self: Sized,
unsafe fn wrap_under_get_rule(ptr: *const Self) -> CFRetained<Self> ⓘwhere
Self: Sized,
core-foundation crate. Read moreSource§fn as_CFTypeRef(&self) -> &CFType
fn as_CFTypeRef(&self) -> &CFType
core-foundation crate.Source§unsafe fn wrap_under_create_rule(ptr: *const Self) -> CFRetained<Self> ⓘwhere
Self: Sized,
unsafe fn wrap_under_create_rule(ptr: *const Self) -> CFRetained<Self> ⓘwhere
Self: Sized,
core-foundation crate. Read more