pub trait INSFormatter: PNSObject {
// Provided methods
fn m_string_for_object_value(&self, obj: id) -> NSString { ... }
fn m_attributed_string_for_object_value_with_default_attributes(
&self,
obj: id,
attrs: NSDictionary<NSAttributedStringKey, id>,
) -> NSAttributedString { ... }
fn m_editing_string_for_object_value(&self, obj: id) -> NSString { ... }
fn m_get_object_value_for_string_error_description(
&self,
obj: &mut id,
string: NSString,
error: &mut NSString,
) -> bool { ... }
fn m_is_partial_string_valid_new_editing_string_error_description(
&self,
partial_string: NSString,
new_string: &mut NSString,
error: &mut NSString,
) -> bool { ... }
fn m_is_partial_string_valid_proposed_selected_range_original_string_original_selected_range_error_description(
&self,
partial_string_ptr: NSString,
proposed_sel_range_ptr: NSRangePointer,
orig_string: NSString,
orig_sel_range: NSRange,
error: &mut NSString,
) -> bool { ... }
}Expand description
A trait containing all the methods for NSFormatter
Provided Methods§
Sourcefn m_string_for_object_value(&self, obj: id) -> NSString
fn m_string_for_object_value(&self, obj: id) -> NSString
The default implementation of this method raises an exception.
§Arguments
obj- The object for which a textual representation is returned.
Sourcefn m_attributed_string_for_object_value_with_default_attributes(
&self,
obj: id,
attrs: NSDictionary<NSAttributedStringKey, id>,
) -> NSAttributedString
fn m_attributed_string_for_object_value_with_default_attributes( &self, obj: id, attrs: NSDictionary<NSAttributedStringKey, id>, ) -> NSAttributedString
The default implementation returns nil to indicate that the formatter object does not provide an attributed string.
§Arguments
obj- The object for which a textual representation is returned.attrs- The default attributes to use for the returned attributed string.
Sourcefn m_editing_string_for_object_value(&self, obj: id) -> NSString
fn m_editing_string_for_object_value(&self, obj: id) -> NSString
The default implementation of this method invokes string_for_object_value.
§Arguments
obj- The object for which to return an editing string.
Sourcefn m_get_object_value_for_string_error_description(
&self,
obj: &mut id,
string: NSString,
error: &mut NSString,
) -> bool
fn m_get_object_value_for_string_error_description( &self, obj: &mut id, string: NSString, error: &mut NSString, ) -> bool
The default implementation of this method raises an exception.
§Arguments
obj- If conversion is successful, upon return contains the object created from string.string- The string to parse.error- If non-nil, if there is a error during the conversion, upon return contains an NSString object that describes the problem.
Sourcefn m_is_partial_string_valid_new_editing_string_error_description(
&self,
partial_string: NSString,
new_string: &mut NSString,
error: &mut NSString,
) -> bool
fn m_is_partial_string_valid_new_editing_string_error_description( &self, partial_string: NSString, new_string: &mut NSString, error: &mut NSString, ) -> bool
Returns a Boolean value that indicates whether a partial string is valid.
§Arguments
partial_string- The text currently in a cell.new_string- If partial_string needs to be modified, upon return contains the replacement string.error- If non-nil, if validation fails contains anNSStringobject that describes the problem.
Sourcefn m_is_partial_string_valid_proposed_selected_range_original_string_original_selected_range_error_description(
&self,
partial_string_ptr: NSString,
proposed_sel_range_ptr: NSRangePointer,
orig_string: NSString,
orig_sel_range: NSRange,
error: &mut NSString,
) -> bool
fn m_is_partial_string_valid_proposed_selected_range_original_string_original_selected_range_error_description( &self, partial_string_ptr: NSString, proposed_sel_range_ptr: NSRangePointer, orig_string: NSString, orig_sel_range: NSRange, error: &mut NSString, ) -> bool
This method should be implemented in subclasses that want to validate user changes to a string in a field, where the user changes are not necessarily at the end of the string, and preserve the selection (or set a different one, such as selecting the erroneous part of the string the user has typed).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.