#[repr(C)]pub struct NSFormatter {
pub ptr: Id<Object>,
}
Expand description
An abstract class that declares an interface for objects that create, interpret, and validate the textual representation of values.
Fields§
§ptr: Id<Object>
The raw pointer to the Objective-C object.
Implementations§
Source§impl NSFormatter
impl NSFormatter
Sourcepub fn string_for_object_value(&self, obj: id) -> NSString
pub fn 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.
Sourcepub fn attributed_string_for_object_value_with_default_attributes(
&self,
obj: id,
attrs: NSDictionary<NSAttributedStringKey, id>,
) -> NSAttributedString
pub fn 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.
Sourcepub fn editing_string_for_object_value(&self, obj: id) -> NSString
pub fn 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.
Sourcepub fn get_object_value_for_string_error_description(
&self,
obj: &mut id,
string: NSString,
error: &mut NSString,
) -> bool
pub fn 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.
Sourcepub fn is_partial_string_valid_new_editing_string_error_description(
&self,
partial_string: NSString,
new_string: &mut NSString,
error: &mut NSString,
) -> bool
pub fn 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 anNSString
object that describes the problem.
Sourcepub fn 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
pub fn 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).
Methods from Deref<Target = Object>§
Sourcepub unsafe fn get_ivar<T>(&self, name: &str) -> &Twhere
T: Encode,
pub unsafe fn get_ivar<T>(&self, name: &str) -> &Twhere
T: Encode,
Returns a reference to the ivar of self with the given name.
Panics if self has no ivar with the given name.
Unsafe because the caller must ensure that the ivar is actually
of type T
.
Sourcepub unsafe fn get_mut_ivar<T>(&mut self, name: &str) -> &mut Twhere
T: Encode,
pub unsafe fn get_mut_ivar<T>(&mut self, name: &str) -> &mut Twhere
T: Encode,
Returns a mutable reference to the ivar of self with the given name.
Panics if self has no ivar with the given name.
Unsafe because the caller must ensure that the ivar is actually
of type T
.