#[repr(C)]pub struct NSObject { /* private fields */ }
Expand description
The root class of most Objective-C class hierarchies.
This represents the NSObject
class. The name “NSObject” also
refers to a protocol, see NSObjectProtocol
for that.
This class has been defined in objc
since macOS 10.8, but is also
re-exported under objc2_foundation::NSObject
, you might want to use that
path instead.
Implementations§
Source§impl NSObject
impl NSObject
Sourcepub fn init(this: Allocated<NSObject>) -> Retained<NSObject>
pub fn init(this: Allocated<NSObject>) -> Retained<NSObject>
Initialize an already allocated object.
See Apple’s documentation for details.
§Example
use objc2::runtime::NSObject;
use objc2::AnyThread;
let obj = NSObject::init(NSObject::alloc());
Sourcepub fn doesNotRecognizeSelector(&self, sel: Sel) -> !
pub fn doesNotRecognizeSelector(&self, sel: Sel) -> !
Handle messages the object doesn’t recognize.
See Apple’s documentation for details.
Methods from Deref<Target = AnyObject>§
Sourcepub fn class(&self) -> &'static AnyClass
pub fn class(&self) -> &'static AnyClass
Dynamically find the class of this object.
§Panics
May panic if the object is invalid (which may be the case for objects
returned from unavailable init
/new
methods).
§Example
Check that an instance of NSObject
has the precise class NSObject
.
use objc2::ClassType;
use objc2::runtime::NSObject;
let obj = NSObject::new();
assert_eq!(obj.class(), NSObject::class());
Sourcepub unsafe fn get_ivar<T>(&self, name: &str) -> &Twhere
T: Encode,
👎Deprecated: this is difficult to use correctly, use Ivar::load
instead.
pub unsafe fn get_ivar<T>(&self, name: &str) -> &Twhere
T: Encode,
Ivar::load
instead.Use Ivar::load
instead.
§Safety
The object must have an instance variable with the given name, and it
must be of type T
.
See Ivar::load_ptr
for details surrounding this.
Sourcepub fn downcast_ref<T>(&self) -> Option<&T>where
T: DowncastTarget,
pub fn downcast_ref<T>(&self) -> Option<&T>where
T: DowncastTarget,
Attempt to downcast the object to a class of type T
.
This is the reference-variant. Use Retained::downcast
if you want
to convert a retained object to another type.
§Mutable classes
Some classes have immutable and mutable variants, such as NSString
and NSMutableString
.
When some Objective-C API signature says it gives you an immutable class, it generally expects you to not mutate that, even though it may technically be mutable “under the hood”.
So using this method to convert a NSString
to a NSMutableString
,
while not unsound, is generally frowned upon unless you created the
string yourself, or the API explicitly documents the string to be
mutable.
See Apple’s documentation on mutability and on
isKindOfClass:
for more details.
§Generic classes
Objective-C generics are called “lightweight generics”, and that’s because they aren’t exposed in the runtime. This makes it impossible to safely downcast to generic collections, so this is disallowed by this method.
You can, however, safely downcast to generic collections where all the
type-parameters are AnyObject
.
§Panics
This works internally by calling isKindOfClass:
. That means that the
object must have the instance method of that name, and an exception
will be thrown (if CoreFoundation is linked) or the process will abort
if that is not the case. In the vast majority of cases, you don’t need
to worry about this, since both root objects NSObject
and
NSProxy
implement this method.
§Examples
Cast an NSString
back and forth from NSObject
.
use objc2::rc::Retained;
use objc2_foundation::{NSObject, NSString};
let obj: Retained<NSObject> = NSString::new().into_super();
let string = obj.downcast_ref::<NSString>().unwrap();
// Or with `downcast`, if we do not need the object afterwards
let string = obj.downcast::<NSString>().unwrap();
Try (and fail) to cast an NSObject
to an NSString
.
use objc2_foundation::{NSObject, NSString};
let obj = NSObject::new();
assert!(obj.downcast_ref::<NSString>().is_none());
Try to cast to an array of strings.
use objc2_foundation::{NSArray, NSObject, NSString};
let arr = NSArray::from_retained_slice(&[NSObject::new()]);
// This is invalid and doesn't type check.
let arr = arr.downcast_ref::<NSArray<NSString>>();
This fails to compile, since it would require enumerating over the array to ensure that each element is of the desired type, which is a performance pitfall.
Downcast when processing each element instead.
use objc2_foundation::{NSArray, NSObject, NSString};
let arr = NSArray::from_retained_slice(&[NSObject::new()]);
for elem in arr {
if let Some(data) = elem.downcast_ref::<NSString>() {
// handle `data`
}
}
Trait Implementations§
Source§impl AsRef<NSObject> for DOMCSSRule
impl AsRef<NSObject> for DOMCSSRule
Source§impl AsRef<NSObject> for DOMCSSValue
impl AsRef<NSObject> for DOMCSSValue
Source§impl AsRef<NSObject> for DOMCharacterData
impl AsRef<NSObject> for DOMCharacterData
Source§impl AsRef<NSObject> for DOMDocument
impl AsRef<NSObject> for DOMDocument
Source§impl AsRef<NSObject> for DOMElement
impl AsRef<NSObject> for DOMElement
Source§impl AsRef<NSObject> for DOMHTMLElement
impl AsRef<NSObject> for DOMHTMLElement
Source§impl AsRef<NSObject> for DOMMouseEvent
impl AsRef<NSObject> for DOMMouseEvent
Source§impl AsRef<NSObject> for DOMStyleSheet
impl AsRef<NSObject> for DOMStyleSheet
Source§impl AsRef<NSObject> for DOMUIEvent
impl AsRef<NSObject> for DOMUIEvent
Source§impl AsRef<NSObject> for NSActionCell
impl AsRef<NSObject> for NSActionCell
Source§impl AsRef<NSObject> for NSAnimation
impl AsRef<NSObject> for NSAnimation
Source§impl AsRef<NSObject> for NSArrayController
impl AsRef<NSObject> for NSArrayController
Source§impl AsRef<NSObject> for NSAttributedString
impl AsRef<NSObject> for NSAttributedString
Source§impl AsRef<NSObject> for NSButtonCell
impl AsRef<NSObject> for NSButtonCell
Source§impl AsRef<NSObject> for NSCharacterSet
impl AsRef<NSObject> for NSCharacterSet
Source§impl AsRef<NSObject> for NSClassDescription
impl AsRef<NSObject> for NSClassDescription
Source§impl AsRef<NSObject> for NSCollectionLayoutItem
impl AsRef<NSObject> for NSCollectionLayoutItem
Source§impl AsRef<NSObject> for NSCollectionViewLayout
impl AsRef<NSObject> for NSCollectionViewLayout
Source§impl AsRef<NSObject> for NSController
impl AsRef<NSObject> for NSController
Source§impl<KeyType, ObjectType> AsRef<NSObject> for NSDictionary<KeyType, ObjectType>
impl<KeyType, ObjectType> AsRef<NSObject> for NSDictionary<KeyType, ObjectType>
Source§impl AsRef<NSObject> for NSDimension
impl AsRef<NSObject> for NSDimension
Source§impl AsRef<NSObject> for NSDocument
impl AsRef<NSObject> for NSDocument
Source§impl<ObjectType> AsRef<NSObject> for NSEnumerator<ObjectType>
impl<ObjectType> AsRef<NSObject> for NSEnumerator<ObjectType>
Source§impl AsRef<NSObject> for NSFontCollection
impl AsRef<NSObject> for NSFontCollection
Source§impl AsRef<NSObject> for NSFormatter
impl AsRef<NSObject> for NSFormatter
Source§impl AsRef<NSObject> for NSGestureRecognizer
impl AsRef<NSObject> for NSGestureRecognizer
Source§impl AsRef<NSObject> for NSImageRep
impl AsRef<NSObject> for NSImageRep
Source§impl AsRef<NSObject> for NSIndexSet
impl AsRef<NSObject> for NSIndexSet
Source§impl AsRef<NSObject> for NSInflectionRule
impl AsRef<NSObject> for NSInflectionRule
Source§impl<AnchorType> AsRef<NSObject> for NSLayoutAnchor<AnchorType>
impl<AnchorType> AsRef<NSObject> for NSLayoutAnchor<AnchorType>
Source§impl AsRef<NSObject> for NSMenuItemCell
impl AsRef<NSObject> for NSMenuItemCell
Source§impl AsRef<NSObject> for NSMutableAttributedString
impl AsRef<NSObject> for NSMutableAttributedString
Source§impl AsRef<NSObject> for NSMutableData
impl AsRef<NSObject> for NSMutableData
Source§impl<ObjectType> AsRef<NSObject> for NSMutableSet<ObjectType>
impl<ObjectType> AsRef<NSObject> for NSMutableSet<ObjectType>
Source§impl AsRef<NSObject> for NSNibConnector
impl AsRef<NSObject> for NSNibConnector
Source§impl AsRef<NSObject> for NSNotification
impl AsRef<NSObject> for NSNotification
Source§impl AsRef<NSObject> for NSNotificationCenter
impl AsRef<NSObject> for NSNotificationCenter
Source§impl AsRef<NSObject> for NSObjectController
impl AsRef<NSObject> for NSObjectController
Source§impl AsRef<NSObject> for NSOperation
impl AsRef<NSObject> for NSOperation
Source§impl<ObjectType> AsRef<NSObject> for NSOrderedSet<ObjectType>
impl<ObjectType> AsRef<NSObject> for NSOrderedSet<ObjectType>
Source§impl AsRef<NSObject> for NSParagraphStyle
impl AsRef<NSObject> for NSParagraphStyle
Source§impl AsRef<NSObject> for NSPersistentStoreRequest
impl AsRef<NSObject> for NSPersistentStoreRequest
Source§impl AsRef<NSObject> for NSPortNameServer
impl AsRef<NSObject> for NSPortNameServer
Source§impl AsRef<NSObject> for NSPredicate
impl AsRef<NSObject> for NSPredicate
Source§impl AsRef<NSObject> for NSPropertyDescription
impl AsRef<NSObject> for NSPropertyDescription
Source§impl AsRef<NSObject> for NSRegularExpression
impl AsRef<NSObject> for NSRegularExpression
Source§impl AsRef<NSObject> for NSResponder
impl AsRef<NSObject> for NSResponder
Source§impl AsRef<NSObject> for NSRuleEditor
impl AsRef<NSObject> for NSRuleEditor
Source§impl AsRef<NSObject> for NSSavePanel
impl AsRef<NSObject> for NSSavePanel
Source§impl AsRef<NSObject> for NSScriptCommand
impl AsRef<NSObject> for NSScriptCommand
Source§impl AsRef<NSObject> for NSScriptObjectSpecifier
impl AsRef<NSObject> for NSScriptObjectSpecifier
Source§impl AsRef<NSObject> for NSScriptWhoseTest
impl AsRef<NSObject> for NSScriptWhoseTest
Source§impl AsRef<NSObject> for NSScrubberArrangedView
impl AsRef<NSObject> for NSScrubberArrangedView
Source§impl AsRef<NSObject> for NSScrubberItemView
impl AsRef<NSObject> for NSScrubberItemView
Source§impl AsRef<NSObject> for NSScrubberLayout
impl AsRef<NSObject> for NSScrubberLayout
Source§impl AsRef<NSObject> for NSSimpleCString
impl AsRef<NSObject> for NSSimpleCString
Source§impl AsRef<NSObject> for NSTableView
impl AsRef<NSObject> for NSTableView
Source§impl AsRef<NSObject> for NSTextBlock
impl AsRef<NSObject> for NSTextBlock
Source§impl AsRef<NSObject> for NSTextContentManager
impl AsRef<NSObject> for NSTextContentManager
Source§impl AsRef<NSObject> for NSTextElement
impl AsRef<NSObject> for NSTextElement
Source§impl AsRef<NSObject> for NSTextField
impl AsRef<NSObject> for NSTextField
Source§impl AsRef<NSObject> for NSTextFieldCell
impl AsRef<NSObject> for NSTextFieldCell
Source§impl AsRef<NSObject> for NSTextParagraph
impl AsRef<NSObject> for NSTextParagraph
Source§impl AsRef<NSObject> for NSToolbarItem
impl AsRef<NSObject> for NSToolbarItem
Source§impl AsRef<NSObject> for NSTouchBarItem
impl AsRef<NSObject> for NSTouchBarItem
Source§impl AsRef<NSObject> for NSTypesetter
impl AsRef<NSObject> for NSTypesetter
Source§impl AsRef<NSObject> for NSURLDownload
impl AsRef<NSObject> for NSURLDownload
Source§impl AsRef<NSObject> for NSURLRequest
impl AsRef<NSObject> for NSURLRequest
Source§impl AsRef<NSObject> for NSURLResponse
impl AsRef<NSObject> for NSURLResponse
Source§impl AsRef<NSObject> for NSURLSessionDataTask
impl AsRef<NSObject> for NSURLSessionDataTask
Source§impl AsRef<NSObject> for NSURLSessionTask
impl AsRef<NSObject> for NSURLSessionTask
Source§impl AsRef<NSObject> for NSUnitConverter
impl AsRef<NSObject> for NSUnitConverter
Source§impl AsRef<NSObject> for NSUserScriptTask
impl AsRef<NSObject> for NSUserScriptTask
Source§impl AsRef<NSObject> for NSValueTransformer
impl AsRef<NSObject> for NSValueTransformer
Source§impl AsRef<NSObject> for NSViewController
impl AsRef<NSObject> for NSViewController
Source§impl AsRef<NSObject> for NSVisualEffectView
impl AsRef<NSObject> for NSVisualEffectView
Source§impl AsRef<NSObject> for WebScriptObject
impl AsRef<NSObject> for WebScriptObject
Source§impl Borrow<NSObject> for DOMCSSRule
impl Borrow<NSObject> for DOMCSSRule
Source§impl Borrow<NSObject> for DOMCSSValue
impl Borrow<NSObject> for DOMCSSValue
Source§impl Borrow<NSObject> for DOMCharacterData
impl Borrow<NSObject> for DOMCharacterData
Source§impl Borrow<NSObject> for DOMDocument
impl Borrow<NSObject> for DOMDocument
Source§impl Borrow<NSObject> for DOMElement
impl Borrow<NSObject> for DOMElement
Source§impl Borrow<NSObject> for DOMHTMLElement
impl Borrow<NSObject> for DOMHTMLElement
Source§impl Borrow<NSObject> for DOMMouseEvent
impl Borrow<NSObject> for DOMMouseEvent
Source§impl Borrow<NSObject> for DOMStyleSheet
impl Borrow<NSObject> for DOMStyleSheet
Source§impl Borrow<NSObject> for DOMUIEvent
impl Borrow<NSObject> for DOMUIEvent
Source§impl Borrow<NSObject> for NSActionCell
impl Borrow<NSObject> for NSActionCell
Source§impl Borrow<NSObject> for NSAnimation
impl Borrow<NSObject> for NSAnimation
Source§impl Borrow<NSObject> for NSArrayController
impl Borrow<NSObject> for NSArrayController
Source§impl Borrow<NSObject> for NSAttributedString
impl Borrow<NSObject> for NSAttributedString
Source§impl Borrow<NSObject> for NSButtonCell
impl Borrow<NSObject> for NSButtonCell
Source§impl Borrow<NSObject> for NSCharacterSet
impl Borrow<NSObject> for NSCharacterSet
Source§impl Borrow<NSObject> for NSClassDescription
impl Borrow<NSObject> for NSClassDescription
Source§impl Borrow<NSObject> for NSCollectionLayoutItem
impl Borrow<NSObject> for NSCollectionLayoutItem
Source§impl Borrow<NSObject> for NSCollectionViewLayout
impl Borrow<NSObject> for NSCollectionViewLayout
Source§impl Borrow<NSObject> for NSController
impl Borrow<NSObject> for NSController
Source§impl<KeyType, ObjectType> Borrow<NSObject> for NSDictionary<KeyType, ObjectType>
impl<KeyType, ObjectType> Borrow<NSObject> for NSDictionary<KeyType, ObjectType>
Source§impl Borrow<NSObject> for NSDimension
impl Borrow<NSObject> for NSDimension
Source§impl Borrow<NSObject> for NSDocument
impl Borrow<NSObject> for NSDocument
Source§impl<ObjectType> Borrow<NSObject> for NSEnumerator<ObjectType>
impl<ObjectType> Borrow<NSObject> for NSEnumerator<ObjectType>
Source§impl Borrow<NSObject> for NSFontCollection
impl Borrow<NSObject> for NSFontCollection
Source§impl Borrow<NSObject> for NSFormatter
impl Borrow<NSObject> for NSFormatter
Source§impl Borrow<NSObject> for NSGestureRecognizer
impl Borrow<NSObject> for NSGestureRecognizer
Source§impl Borrow<NSObject> for NSImageRep
impl Borrow<NSObject> for NSImageRep
Source§impl Borrow<NSObject> for NSIndexSet
impl Borrow<NSObject> for NSIndexSet
Source§impl Borrow<NSObject> for NSInflectionRule
impl Borrow<NSObject> for NSInflectionRule
Source§impl<AnchorType> Borrow<NSObject> for NSLayoutAnchor<AnchorType>
impl<AnchorType> Borrow<NSObject> for NSLayoutAnchor<AnchorType>
Source§impl Borrow<NSObject> for NSMenuItemCell
impl Borrow<NSObject> for NSMenuItemCell
Source§impl Borrow<NSObject> for NSMutableAttributedString
impl Borrow<NSObject> for NSMutableAttributedString
Source§impl Borrow<NSObject> for NSMutableData
impl Borrow<NSObject> for NSMutableData
Source§impl<ObjectType> Borrow<NSObject> for NSMutableSet<ObjectType>
impl<ObjectType> Borrow<NSObject> for NSMutableSet<ObjectType>
Source§impl Borrow<NSObject> for NSNibConnector
impl Borrow<NSObject> for NSNibConnector
Source§impl Borrow<NSObject> for NSNotification
impl Borrow<NSObject> for NSNotification
Source§impl Borrow<NSObject> for NSNotificationCenter
impl Borrow<NSObject> for NSNotificationCenter
Source§impl Borrow<NSObject> for NSObjectController
impl Borrow<NSObject> for NSObjectController
Source§impl Borrow<NSObject> for NSOperation
impl Borrow<NSObject> for NSOperation
Source§impl<ObjectType> Borrow<NSObject> for NSOrderedSet<ObjectType>
impl<ObjectType> Borrow<NSObject> for NSOrderedSet<ObjectType>
Source§impl Borrow<NSObject> for NSParagraphStyle
impl Borrow<NSObject> for NSParagraphStyle
Source§impl Borrow<NSObject> for NSPersistentStoreRequest
impl Borrow<NSObject> for NSPersistentStoreRequest
Source§impl Borrow<NSObject> for NSPortNameServer
impl Borrow<NSObject> for NSPortNameServer
Source§impl Borrow<NSObject> for NSPredicate
impl Borrow<NSObject> for NSPredicate
Source§impl Borrow<NSObject> for NSPropertyDescription
impl Borrow<NSObject> for NSPropertyDescription
Source§impl Borrow<NSObject> for NSRegularExpression
impl Borrow<NSObject> for NSRegularExpression
Source§impl Borrow<NSObject> for NSResponder
impl Borrow<NSObject> for NSResponder
Source§impl Borrow<NSObject> for NSRuleEditor
impl Borrow<NSObject> for NSRuleEditor
Source§impl Borrow<NSObject> for NSSavePanel
impl Borrow<NSObject> for NSSavePanel
Source§impl Borrow<NSObject> for NSScriptCommand
impl Borrow<NSObject> for NSScriptCommand
Source§impl Borrow<NSObject> for NSScriptObjectSpecifier
impl Borrow<NSObject> for NSScriptObjectSpecifier
Source§impl Borrow<NSObject> for NSScriptWhoseTest
impl Borrow<NSObject> for NSScriptWhoseTest
Source§impl Borrow<NSObject> for NSScrubberArrangedView
impl Borrow<NSObject> for NSScrubberArrangedView
Source§impl Borrow<NSObject> for NSScrubberItemView
impl Borrow<NSObject> for NSScrubberItemView
Source§impl Borrow<NSObject> for NSScrubberLayout
impl Borrow<NSObject> for NSScrubberLayout
Source§impl Borrow<NSObject> for NSSimpleCString
impl Borrow<NSObject> for NSSimpleCString
Source§impl Borrow<NSObject> for NSTableView
impl Borrow<NSObject> for NSTableView
Source§impl Borrow<NSObject> for NSTextBlock
impl Borrow<NSObject> for NSTextBlock
Source§impl Borrow<NSObject> for NSTextContentManager
impl Borrow<NSObject> for NSTextContentManager
Source§impl Borrow<NSObject> for NSTextElement
impl Borrow<NSObject> for NSTextElement
Source§impl Borrow<NSObject> for NSTextField
impl Borrow<NSObject> for NSTextField
Source§impl Borrow<NSObject> for NSTextFieldCell
impl Borrow<NSObject> for NSTextFieldCell
Source§impl Borrow<NSObject> for NSTextParagraph
impl Borrow<NSObject> for NSTextParagraph
Source§impl Borrow<NSObject> for NSToolbarItem
impl Borrow<NSObject> for NSToolbarItem
Source§impl Borrow<NSObject> for NSTouchBarItem
impl Borrow<NSObject> for NSTouchBarItem
Source§impl Borrow<NSObject> for NSTypesetter
impl Borrow<NSObject> for NSTypesetter
Source§impl Borrow<NSObject> for NSURLDownload
impl Borrow<NSObject> for NSURLDownload
Source§impl Borrow<NSObject> for NSURLRequest
impl Borrow<NSObject> for NSURLRequest
Source§impl Borrow<NSObject> for NSURLResponse
impl Borrow<NSObject> for NSURLResponse
Source§impl Borrow<NSObject> for NSURLSessionDataTask
impl Borrow<NSObject> for NSURLSessionDataTask
Source§impl Borrow<NSObject> for NSURLSessionTask
impl Borrow<NSObject> for NSURLSessionTask
Source§impl Borrow<NSObject> for NSUnitConverter
impl Borrow<NSObject> for NSUnitConverter
Source§impl Borrow<NSObject> for NSUserScriptTask
impl Borrow<NSObject> for NSUserScriptTask
Source§impl Borrow<NSObject> for NSValueTransformer
impl Borrow<NSObject> for NSValueTransformer
Source§impl Borrow<NSObject> for NSViewController
impl Borrow<NSObject> for NSViewController
Source§impl Borrow<NSObject> for NSVisualEffectView
impl Borrow<NSObject> for NSVisualEffectView
Source§impl Borrow<NSObject> for WebScriptObject
impl Borrow<NSObject> for WebScriptObject
Source§impl ClassType for NSObject
impl ClassType for NSObject
Source§const NAME: &'static str = "NSObject"
const NAME: &'static str = "NSObject"
Source§type ThreadKind = dyn AnyThread
type ThreadKind = dyn AnyThread
Source§impl DefaultRetained for NSObject
impl DefaultRetained for NSObject
Source§impl Hash for NSObject
Hashing in Objective-C has the exact same requirement as in Rust:
impl Hash for NSObject
Hashing in Objective-C has the exact same requirement as in Rust:
If two objects are equal (as determined by the isEqual: method), they must have the same hash value.
See https://developer.apple.com/documentation/objectivec/1418956-nsobject/1418859-hash
Source§impl NSObjectNSAccessibility for NSObject
impl NSObjectNSAccessibility for NSObject
Source§unsafe fn accessibilityAttributeNames(&self) -> Retained<NSArray<NSString>>
unsafe fn accessibilityAttributeNames(&self) -> Retained<NSArray<NSString>>
Source§unsafe fn accessibilityAttributeValue(
&self,
attribute: &NSString,
) -> Option<Retained<AnyObject>>
unsafe fn accessibilityAttributeValue( &self, attribute: &NSString, ) -> Option<Retained<AnyObject>>
Source§unsafe fn accessibilityIsAttributeSettable(&self, attribute: &NSString) -> bool
unsafe fn accessibilityIsAttributeSettable(&self, attribute: &NSString) -> bool
Source§unsafe fn accessibilitySetValue_forAttribute(
&self,
value: Option<&AnyObject>,
attribute: &NSString,
)
unsafe fn accessibilitySetValue_forAttribute( &self, value: Option<&AnyObject>, attribute: &NSString, )
Source§unsafe fn accessibilityParameterizedAttributeNames(
&self,
) -> Retained<NSArray<NSString>>
unsafe fn accessibilityParameterizedAttributeNames( &self, ) -> Retained<NSArray<NSString>>
Source§unsafe fn accessibilityAttributeValue_forParameter(
&self,
attribute: &NSString,
parameter: Option<&AnyObject>,
) -> Option<Retained<AnyObject>>
unsafe fn accessibilityAttributeValue_forParameter( &self, attribute: &NSString, parameter: Option<&AnyObject>, ) -> Option<Retained<AnyObject>>
Source§unsafe fn accessibilityActionNames(&self) -> Retained<NSArray<NSString>>
unsafe fn accessibilityActionNames(&self) -> Retained<NSArray<NSString>>
Source§unsafe fn accessibilityActionDescription(
&self,
action: &NSString,
) -> Option<Retained<NSString>>
unsafe fn accessibilityActionDescription( &self, action: &NSString, ) -> Option<Retained<NSString>>
Source§unsafe fn accessibilityPerformAction(&self, action: &NSString)
unsafe fn accessibilityPerformAction(&self, action: &NSString)
Source§unsafe fn accessibilityIsIgnored(&self) -> bool
unsafe fn accessibilityIsIgnored(&self) -> bool
unsafe fn accessibilityHitTest( &self, point: CGPoint, ) -> Option<Retained<AnyObject>>
unsafe fn accessibilityFocusedUIElement(&self) -> Option<Retained<AnyObject>>
unsafe fn accessibilityIndexOfChild(&self, child: &AnyObject) -> usize
unsafe fn accessibilityArrayAttributeCount(&self, attribute: &NSString) -> usize
unsafe fn accessibilityArrayAttributeValues_index_maxCount( &self, attribute: &NSString, index: usize, max_count: usize, ) -> Retained<NSArray>
unsafe fn accessibilityNotifiesWhenDestroyed(&self) -> bool
Source§impl NSObjectNSArchiverCallback for NSObject
impl NSObjectNSArchiverCallback for NSObject
unsafe fn classForArchiver(&self) -> Option<&'static AnyClass>
Source§unsafe fn replacementObjectForArchiver(
&self,
archiver: &NSArchiver,
) -> Option<Retained<AnyObject>>
unsafe fn replacementObjectForArchiver( &self, archiver: &NSArchiver, ) -> Option<Retained<AnyObject>>
Source§impl NSObjectNSClassDescriptionPrimitives for NSObject
impl NSObjectNSClassDescriptionPrimitives for NSObject
unsafe fn classDescription(&self) -> Retained<NSClassDescription>
unsafe fn attributeKeys(&self) -> Retained<NSArray<NSString>>
unsafe fn toOneRelationshipKeys(&self) -> Retained<NSArray<NSString>>
unsafe fn toManyRelationshipKeys(&self) -> Retained<NSArray<NSString>>
unsafe fn inverseForRelationshipKey( &self, relationship_key: &NSString, ) -> Option<Retained<NSString>>
Source§impl NSObjectNSCoderMethods for NSObject
impl NSObjectNSCoderMethods for NSObject
Source§impl NSObjectNSComparisonMethods for NSObject
impl NSObjectNSComparisonMethods for NSObject
unsafe fn isEqualTo(&self, object: Option<&AnyObject>) -> bool
unsafe fn isLessThanOrEqualTo(&self, object: Option<&AnyObject>) -> bool
unsafe fn isLessThan(&self, object: Option<&AnyObject>) -> bool
unsafe fn isGreaterThanOrEqualTo(&self, object: Option<&AnyObject>) -> bool
unsafe fn isGreaterThan(&self, object: Option<&AnyObject>) -> bool
unsafe fn isNotEqualTo(&self, object: Option<&AnyObject>) -> bool
unsafe fn doesContain(&self, object: &AnyObject) -> bool
unsafe fn isLike(&self, object: &NSString) -> bool
unsafe fn isCaseInsensitiveLike(&self, object: &NSString) -> bool
Source§impl NSObjectNSDelayedPerforming for NSObject
impl NSObjectNSDelayedPerforming for NSObject
unsafe fn performSelector_withObject_afterDelay_inModes( &self, a_selector: Sel, an_argument: Option<&AnyObject>, delay: f64, modes: &NSArray<NSString>, )
unsafe fn performSelector_withObject_afterDelay( &self, a_selector: Sel, an_argument: Option<&AnyObject>, delay: f64, )
unsafe fn cancelPreviousPerformRequestsWithTarget_selector_object( a_target: &AnyObject, a_selector: Sel, an_argument: Option<&AnyObject>, )
unsafe fn cancelPreviousPerformRequestsWithTarget(a_target: &AnyObject)
Source§impl NSObjectNSDiscardableContentProxy for NSObject
impl NSObjectNSDiscardableContentProxy for NSObject
unsafe fn autoContentAccessingProxy(&self) -> Retained<AnyObject>
Source§impl NSObjectNSErrorRecoveryAttempting for NSObject
impl NSObjectNSErrorRecoveryAttempting for NSObject
unsafe fn attemptRecoveryFromError_optionIndex_delegate_didRecoverSelector_contextInfo( &self, error: &NSError, recovery_option_index: usize, delegate: Option<&AnyObject>, did_recover_selector: Option<Sel>, context_info: *mut c_void, )
unsafe fn attemptRecoveryFromError_optionIndex( &self, error: &NSError, recovery_option_index: usize, ) -> bool
Source§impl NSObjectNSKeyValueBindingCreation for NSObject
impl NSObjectNSKeyValueBindingCreation for NSObject
unsafe fn exposeBinding(binding: &NSString)
unsafe fn exposedBindings(&self) -> Retained<NSArray<NSString>>
unsafe fn valueClassForBinding( &self, binding: &NSString, ) -> Option<&'static AnyClass>
unsafe fn bind_toObject_withKeyPath_options( &self, binding: &NSString, observable: &AnyObject, key_path: &NSString, options: Option<&NSDictionary<NSString>>, )
unsafe fn unbind(&self, binding: &NSString)
unsafe fn infoForBinding( &self, binding: &NSString, ) -> Option<Retained<NSDictionary<NSString>>>
unsafe fn optionDescriptionsForBinding( &self, binding: &NSString, ) -> Retained<NSArray<NSAttributeDescription>>
Source§impl NSObjectNSKeyValueCoding for NSObject
impl NSObjectNSKeyValueCoding for NSObject
unsafe fn accessInstanceVariablesDirectly() -> bool
unsafe fn valueForKey(&self, key: &NSString) -> Option<Retained<AnyObject>>
unsafe fn setValue_forKey(&self, value: Option<&AnyObject>, key: &NSString)
unsafe fn validateValue_forKey_error( &self, io_value: &mut Option<Retained<AnyObject>>, in_key: &NSString, ) -> Result<(), Retained<NSError>>
unsafe fn mutableArrayValueForKey( &self, key: &NSString, ) -> Retained<NSMutableArray>
unsafe fn mutableOrderedSetValueForKey( &self, key: &NSString, ) -> Retained<NSMutableOrderedSet>
unsafe fn mutableSetValueForKey(&self, key: &NSString) -> Retained<NSMutableSet>
unsafe fn valueForKeyPath( &self, key_path: &NSString, ) -> Option<Retained<AnyObject>>
unsafe fn setValue_forKeyPath( &self, value: Option<&AnyObject>, key_path: &NSString, )
unsafe fn validateValue_forKeyPath_error( &self, io_value: &mut Option<Retained<AnyObject>>, in_key_path: &NSString, ) -> Result<(), Retained<NSError>>
unsafe fn mutableArrayValueForKeyPath( &self, key_path: &NSString, ) -> Retained<NSMutableArray>
unsafe fn mutableOrderedSetValueForKeyPath( &self, key_path: &NSString, ) -> Retained<NSMutableOrderedSet>
unsafe fn mutableSetValueForKeyPath( &self, key_path: &NSString, ) -> Retained<NSMutableSet>
unsafe fn valueForUndefinedKey( &self, key: &NSString, ) -> Option<Retained<AnyObject>>
unsafe fn setValue_forUndefinedKey( &self, value: Option<&AnyObject>, key: &NSString, )
unsafe fn setNilValueForKey(&self, key: &NSString)
unsafe fn dictionaryWithValuesForKeys( &self, keys: &NSArray<NSString>, ) -> Retained<NSDictionary<NSString>>
unsafe fn setValuesForKeysWithDictionary( &self, keyed_values: &NSDictionary<NSString>, )
Source§impl NSObjectNSKeyValueObserverNotification for NSObject
impl NSObjectNSKeyValueObserverNotification for NSObject
unsafe fn willChangeValueForKey(&self, key: &NSString)
unsafe fn didChangeValueForKey(&self, key: &NSString)
unsafe fn willChange_valuesAtIndexes_forKey( &self, change_kind: NSKeyValueChange, indexes: &NSIndexSet, key: &NSString, )
unsafe fn didChange_valuesAtIndexes_forKey( &self, change_kind: NSKeyValueChange, indexes: &NSIndexSet, key: &NSString, )
unsafe fn willChangeValueForKey_withSetMutation_usingObjects( &self, key: &NSString, mutation_kind: NSKeyValueSetMutationKind, objects: &NSSet, )
unsafe fn didChangeValueForKey_withSetMutation_usingObjects( &self, key: &NSString, mutation_kind: NSKeyValueSetMutationKind, objects: &NSSet, )
Source§impl NSObjectNSKeyValueObserverRegistration for NSObject
impl NSObjectNSKeyValueObserverRegistration for NSObject
unsafe fn addObserver_forKeyPath_options_context( &self, observer: &NSObject, key_path: &NSString, options: NSKeyValueObservingOptions, context: *mut c_void, )
unsafe fn removeObserver_forKeyPath_context( &self, observer: &NSObject, key_path: &NSString, context: *mut c_void, )
unsafe fn removeObserver_forKeyPath( &self, observer: &NSObject, key_path: &NSString, )
Source§impl NSObjectNSKeyValueObservingCustomization for NSObject
impl NSObjectNSKeyValueObservingCustomization for NSObject
unsafe fn keyPathsForValuesAffectingValueForKey( key: &NSString, ) -> Retained<NSSet<NSString>>
unsafe fn automaticallyNotifiesObserversForKey(key: &NSString) -> bool
unsafe fn observationInfo(&self) -> *mut c_void
Source§unsafe fn setObservationInfo(&self, observation_info: *mut c_void)
unsafe fn setObservationInfo(&self, observation_info: *mut c_void)
observationInfo
.Source§impl NSObjectNSKeyedArchiverObjectSubstitution for NSObject
impl NSObjectNSKeyedArchiverObjectSubstitution for NSObject
unsafe fn classForKeyedArchiver(&self) -> Option<&'static AnyClass>
unsafe fn replacementObjectForKeyedArchiver( &self, archiver: &NSKeyedArchiver, ) -> Option<Retained<AnyObject>>
unsafe fn classFallbacksForKeyedArchiver() -> Retained<NSArray<NSString>>
Source§impl NSObjectNSKeyedUnarchiverObjectSubstitution for NSObject
impl NSObjectNSKeyedUnarchiverObjectSubstitution for NSObject
unsafe fn classForKeyedUnarchiver() -> &'static AnyClass
Source§impl NSObjectNSNibAwaking for NSObject
impl NSObjectNSNibAwaking for NSObject
unsafe fn awakeFromNib(&self)
unsafe fn prepareForInterfaceBuilder(&self)
Source§impl NSObjectNSScriptKeyValueCoding for NSObject
impl NSObjectNSScriptKeyValueCoding for NSObject
unsafe fn valueAtIndex_inPropertyWithKey( &self, index: usize, key: &NSString, ) -> Option<Retained<AnyObject>>
unsafe fn valueWithName_inPropertyWithKey( &self, name: &NSString, key: &NSString, ) -> Option<Retained<AnyObject>>
unsafe fn valueWithUniqueID_inPropertyWithKey( &self, unique_id: &AnyObject, key: &NSString, ) -> Option<Retained<AnyObject>>
unsafe fn insertValue_atIndex_inPropertyWithKey( &self, value: &AnyObject, index: usize, key: &NSString, )
unsafe fn removeValueAtIndex_fromPropertyWithKey( &self, index: usize, key: &NSString, )
unsafe fn replaceValueAtIndex_inPropertyWithKey_withValue( &self, index: usize, key: &NSString, value: &AnyObject, )
unsafe fn insertValue_inPropertyWithKey( &self, value: &AnyObject, key: &NSString, )
unsafe fn coerceValue_forKey( &self, value: Option<&AnyObject>, key: &NSString, ) -> Option<Retained<AnyObject>>
Source§impl NSObjectNSScriptObjectSpecifiers for NSObject
impl NSObjectNSScriptObjectSpecifiers for NSObject
unsafe fn objectSpecifier(&self) -> Option<Retained<NSScriptObjectSpecifier>>
unsafe fn indicesOfObjectsByEvaluatingObjectSpecifier( &self, specifier: &NSScriptObjectSpecifier, ) -> Option<Retained<NSArray<NSNumber>>>
Source§impl NSObjectNSScripting for NSObject
impl NSObjectNSScripting for NSObject
unsafe fn scriptingValueForSpecifier( &self, object_specifier: &NSScriptObjectSpecifier, ) -> Option<Retained<AnyObject>>
unsafe fn scriptingProperties(&self) -> Option<Retained<NSDictionary<NSString>>>
Source§unsafe fn setScriptingProperties(
&self,
scripting_properties: Option<&NSDictionary<NSString>>,
)
unsafe fn setScriptingProperties( &self, scripting_properties: Option<&NSDictionary<NSString>>, )
scriptingProperties
.unsafe fn copyScriptingValue_forKey_withProperties( &self, value: &AnyObject, key: &NSString, properties: &NSDictionary<NSString>, ) -> Option<Retained<AnyObject>>
unsafe fn newScriptingObjectOfClass_forValueForKey_withContentsValue_properties( &self, object_class: &AnyClass, key: &NSString, contents_value: Option<&AnyObject>, properties: &NSDictionary<NSString>, ) -> Option<Retained<AnyObject>>
Source§impl NSObjectNSScriptingComparisonMethods for NSObject
impl NSObjectNSScriptingComparisonMethods for NSObject
unsafe fn scriptingIsEqualTo(&self, object: &AnyObject) -> bool
unsafe fn scriptingIsLessThanOrEqualTo(&self, object: &AnyObject) -> bool
unsafe fn scriptingIsLessThan(&self, object: &AnyObject) -> bool
unsafe fn scriptingIsGreaterThanOrEqualTo(&self, object: &AnyObject) -> bool
unsafe fn scriptingIsGreaterThan(&self, object: &AnyObject) -> bool
unsafe fn scriptingBeginsWith(&self, object: &AnyObject) -> bool
unsafe fn scriptingEndsWith(&self, object: &AnyObject) -> bool
unsafe fn scriptingContains(&self, object: &AnyObject) -> bool
Source§impl NSObjectNSThreadPerformAdditions for NSObject
impl NSObjectNSThreadPerformAdditions for NSObject
unsafe fn performSelectorOnMainThread_withObject_waitUntilDone_modes( &self, a_selector: Sel, arg: Option<&AnyObject>, wait: bool, array: Option<&NSArray<NSString>>, )
unsafe fn performSelectorOnMainThread_withObject_waitUntilDone( &self, a_selector: Sel, arg: Option<&AnyObject>, wait: bool, )
unsafe fn performSelector_onThread_withObject_waitUntilDone_modes( &self, a_selector: Sel, thr: &NSThread, arg: Option<&AnyObject>, wait: bool, array: Option<&NSArray<NSString>>, )
unsafe fn performSelector_onThread_withObject_waitUntilDone( &self, a_selector: Sel, thr: &NSThread, arg: Option<&AnyObject>, wait: bool, )
unsafe fn performSelectorInBackground_withObject( &self, a_selector: Sel, arg: Option<&AnyObject>, )
Source§impl NSObjectProtocol for NSObject
impl NSObjectProtocol for NSObject
Source§fn isEqual(&self, other: Option<&AnyObject>) -> bool
fn isEqual(&self, other: Option<&AnyObject>) -> bool
Source§fn hash(&self) -> usize
fn hash(&self) -> usize
Source§fn isKindOfClass(&self, cls: &AnyClass) -> bool
fn isKindOfClass(&self, cls: &AnyClass) -> bool
Source§fn is_kind_of<T>(&self) -> bool
fn is_kind_of<T>(&self) -> bool
isKindOfClass
directly, or cast your objects with AnyObject::downcast_ref
Source§fn isMemberOfClass(&self, cls: &AnyClass) -> bool
fn isMemberOfClass(&self, cls: &AnyClass) -> bool
Source§fn respondsToSelector(&self, aSelector: Sel) -> bool
fn respondsToSelector(&self, aSelector: Sel) -> bool
Source§fn conformsToProtocol(&self, aProtocol: &AnyProtocol) -> bool
fn conformsToProtocol(&self, aProtocol: &AnyProtocol) -> bool
Source§fn debugDescription(&self) -> Retained<NSObject>
fn debugDescription(&self) -> Retained<NSObject>
Source§impl NSObjectWebPlugIn for NSObject
impl NSObjectWebPlugIn for NSObject
Source§unsafe fn webPlugInInitialize(&self)
unsafe fn webPlugInInitialize(&self)
Source§unsafe fn webPlugInStart(&self)
unsafe fn webPlugInStart(&self)
Source§unsafe fn webPlugInStop(&self)
unsafe fn webPlugInStop(&self)
Source§unsafe fn webPlugInDestroy(&self)
unsafe fn webPlugInDestroy(&self)
Source§unsafe fn webPlugInSetIsSelected(&self, is_selected: bool)
unsafe fn webPlugInSetIsSelected(&self, is_selected: bool)
Source§unsafe fn objectForWebScript(&self) -> Option<Retained<AnyObject>>
unsafe fn objectForWebScript(&self) -> Option<Retained<AnyObject>>
Source§unsafe fn webPlugInMainResourceDidReceiveResponse(
&self,
response: Option<&NSURLResponse>,
)
unsafe fn webPlugInMainResourceDidReceiveResponse( &self, response: Option<&NSURLResponse>, )
Source§unsafe fn webPlugInMainResourceDidReceiveData(&self, data: Option<&NSData>)
unsafe fn webPlugInMainResourceDidReceiveData(&self, data: Option<&NSData>)
Source§unsafe fn webPlugInMainResourceDidFailWithError(&self, error: Option<&NSError>)
unsafe fn webPlugInMainResourceDidFailWithError(&self, error: Option<&NSError>)
Source§unsafe fn webPlugInMainResourceDidFinishLoading(&self)
unsafe fn webPlugInMainResourceDidFinishLoading(&self)
Source§impl NSObjectWebPlugInContainer for NSObject
impl NSObjectWebPlugInContainer for NSObject
Source§unsafe fn webPlugInContainerLoadRequest_inFrame(
&self,
request: Option<&NSURLRequest>,
target: Option<&NSString>,
)
unsafe fn webPlugInContainerLoadRequest_inFrame( &self, request: Option<&NSURLRequest>, target: Option<&NSString>, )
Source§unsafe fn webPlugInContainerShowStatus(&self, message: Option<&NSString>)
unsafe fn webPlugInContainerShowStatus(&self, message: Option<&NSString>)
Source§impl NSObjectWebScripting for NSObject
impl NSObjectWebScripting for NSObject
Source§unsafe fn webScriptNameForSelector(
selector: Option<Sel>,
) -> Option<Retained<NSString>>
unsafe fn webScriptNameForSelector( selector: Option<Sel>, ) -> Option<Retained<NSString>>
selector
: The selector that will be exposed to the script environment. Read moreSource§unsafe fn isSelectorExcludedFromWebScript(selector: Option<Sel>) -> bool
unsafe fn isSelectorExcludedFromWebScript(selector: Option<Sel>) -> bool
selector
: The selector the will be exposed to the script environment. Read moreSource§unsafe fn webScriptNameForKey(name: *const i8) -> Option<Retained<NSString>>
unsafe fn webScriptNameForKey(name: *const i8) -> Option<Retained<NSString>>
name
: The name of the instance variable that will be exposed to the
script environment. Only instance variables that meet the export criteria will
be exposed. Read moreSource§unsafe fn isKeyExcludedFromWebScript(name: *const i8) -> bool
unsafe fn isKeyExcludedFromWebScript(name: *const i8) -> bool
name
: The name of the instance variable that will be exposed to the
script environment. Read moreSource§unsafe fn invokeUndefinedMethodFromWebScript_withArguments(
&self,
name: Option<&NSString>,
arguments: Option<&NSArray>,
) -> Option<Retained<AnyObject>>
unsafe fn invokeUndefinedMethodFromWebScript_withArguments( &self, name: Option<&NSString>, arguments: Option<&NSArray>, ) -> Option<Retained<AnyObject>>
name
: The name of the method to invoke. Read moreSource§unsafe fn invokeDefaultMethodWithArguments(
&self,
arguments: Option<&NSArray>,
) -> Option<Retained<AnyObject>>
unsafe fn invokeDefaultMethodWithArguments( &self, arguments: Option<&NSArray>, ) -> Option<Retained<AnyObject>>
arguments
: The arguments to pass the method. Read moreSource§unsafe fn finalizeForWebScript(&self)
unsafe fn finalizeForWebScript(&self)
Source§impl PartialEq for NSObject
Objective-C equality has approximately the same semantics as Rust
equality (although less aptly specified).
impl PartialEq for NSObject
Objective-C equality has approximately the same semantics as Rust equality (although less aptly specified).
At the very least, equality is expected to be symmetric and transitive, and that’s about the best we can do.
See also https://nshipster.com/equality/
Source§impl RefEncode for NSObject
impl RefEncode for NSObject
Source§const ENCODING_REF: Encoding = <AnyObject as crate::RefEncode>::ENCODING_REF
const ENCODING_REF: Encoding = <AnyObject as crate::RefEncode>::ENCODING_REF
impl DowncastTarget for NSObject
impl Eq for NSObject
Most types’ equality is reflexive.
Auto Trait Implementations§
impl !Freeze for NSObject
impl !RefUnwindSafe for NSObject
impl !Send for NSObject
impl !Sync for NSObject
impl !Unpin for NSObject
impl !UnwindSafe for NSObject
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.