Trait NSObjectWebScripting

Source
pub unsafe trait NSObjectWebScripting:
    ClassType
    + Sized
    + Sealed {
    // Provided methods
    unsafe fn webScriptNameForSelector(
        selector: Option<Sel>,
    ) -> Option<Retained<NSString>> { ... }
    unsafe fn isSelectorExcludedFromWebScript(selector: Option<Sel>) -> bool { ... }
    unsafe fn webScriptNameForKey(
        name: *const c_char,
    ) -> Option<Retained<NSString>> { ... }
    unsafe fn isKeyExcludedFromWebScript(name: *const c_char) -> bool { ... }
    unsafe fn invokeUndefinedMethodFromWebScript_withArguments(
        &self,
        name: Option<&NSString>,
        arguments: Option<&NSArray>,
    ) -> Option<Retained<AnyObject>> { ... }
    unsafe fn invokeDefaultMethodWithArguments(
        &self,
        arguments: Option<&NSArray>,
    ) -> Option<Retained<AnyObject>> { ... }
    unsafe fn finalizeForWebScript(&self) { ... }
}
Available on crate feature WebScriptObject only.
Expand description

Category “WebScripting” on NSObject.

Provided Methods§

Source

unsafe fn webScriptNameForSelector( selector: Option<Sel>, ) -> Option<Retained<NSString>>

Parameter selector: The selector that will be exposed to the script environment.

Use the returned string as the exported name for the selector in the script environment. It is the responsibility of the class to ensure uniqueness of the returned name. If nil is returned or this method is not implemented the default name for the selector will be used. The default name concatenates the components of the Objective-C selector name and replaces ‘:’ with ‘’. ‘’ characters are escaped with an additional ‘$’, i.e. ‘’ becomes “$”. ‘$’ are also escaped, i.e. Objective-C name Default script name moveTo:: move__ moveTo_ moveTo$_ moveTo$_ moveTo$$$_

Returns: Returns the name to be used to represent the specified selector in the scripting environment.

Source

unsafe fn isSelectorExcludedFromWebScript(selector: Option<Sel>) -> bool

Parameter selector: The selector the will be exposed to the script environment.

Return NO to export the selector to the script environment. Return YES to prevent the selector from being exported to the script environment. If this method is not implemented on the class no selectors will be exported.

Returns: Returns YES to hide the selector, NO to export the selector.

Source

unsafe fn webScriptNameForKey(name: *const c_char) -> Option<Retained<NSString>>

Parameter 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.

Provide an alternate name for a property.

Returns: Returns the name to be used to represent the specified property in the scripting environment.

Source

unsafe fn isKeyExcludedFromWebScript(name: *const c_char) -> bool

Parameter name: The name of the instance variable that will be exposed to the script environment.

Return NO to export the property to the script environment. Return YES to prevent the property from being exported to the script environment.

Returns: Returns YES to hide the property, NO to export the property.

Source

unsafe fn invokeUndefinedMethodFromWebScript_withArguments( &self, name: Option<&NSString>, arguments: Option<&NSArray>, ) -> Option<Retained<AnyObject>>

Parameter name: The name of the method to invoke.

Parameter arguments: The arguments to pass the method.

If a script attempts to invoke a method that is not exported, invokeUndefinedMethodFromWebScript:withArguments: will be called.

Returns: The return value of the invocation. The value will be converted as appropriate for the script environment.

Source

unsafe fn invokeDefaultMethodWithArguments( &self, arguments: Option<&NSArray>, ) -> Option<Retained<AnyObject>>

Parameter arguments: The arguments to pass the method.

If a script attempts to call an exposed object as a function, this method will be called.

Returns: The return value of the call. The value will be converted as appropriate for the script environment.

Source

unsafe fn finalizeForWebScript(&self)

finalizeForScript is called on objects exposed to the script environment just before the script environment garbage collects the object. Subsequently, any references to WebScriptObjects made by the exposed object will be invalid and have undefined consequences.

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.

Implementations on Foreign Types§

Source§

impl NSObjectWebScripting for NSObject

Implementors§