Trait NSAttributedStringWebKitAdditions

Source
pub unsafe trait NSAttributedStringWebKitAdditions:
    ClassType
    + Sized
    + Sealed {
    // Provided methods
    unsafe fn loadFromHTMLWithRequest_options_completionHandler(
        request: &NSURLRequest,
        options: &NSDictionary<NSAttributedStringDocumentReadingOptionKey, AnyObject>,
        completion_handler: NSAttributedStringCompletionHandler,
    ) { ... }
    unsafe fn loadFromHTMLWithFileURL_options_completionHandler(
        file_url: &NSURL,
        options: &NSDictionary<NSAttributedStringDocumentReadingOptionKey, AnyObject>,
        completion_handler: NSAttributedStringCompletionHandler,
    ) { ... }
    unsafe fn loadFromHTMLWithString_options_completionHandler(
        string: &NSString,
        options: &NSDictionary<NSAttributedStringDocumentReadingOptionKey, AnyObject>,
        completion_handler: NSAttributedStringCompletionHandler,
    ) { ... }
    unsafe fn loadFromHTMLWithData_options_completionHandler(
        data: &NSData,
        options: &NSDictionary<NSAttributedStringDocumentReadingOptionKey, AnyObject>,
        completion_handler: NSAttributedStringCompletionHandler,
    ) { ... }
}
Available on crate feature NSAttributedString only.
Expand description

Category on NSAttributedString. Extension of

 //apple_ref/occ/NSAttributedString NSAttributedString

to create attributed strings from HTML content using WebKit.

Provided Methods§

Source

unsafe fn loadFromHTMLWithRequest_options_completionHandler( request: &NSURLRequest, options: &NSDictionary<NSAttributedStringDocumentReadingOptionKey, AnyObject>, completion_handler: NSAttributedStringCompletionHandler, )

Available on crate feature block2 and crate feature objc2-app-kit and macOS only.

Loads an HTML URL request and converts the contents into an attributed string.

Parameter request: The request specifying the URL to load.

Parameter options: Document attributes for interpreting the document contents. NSTextSizeMultiplierDocumentOption and NSTimeoutDocumentOption are supported option keys.

Parameter completionHandler: A block to invoke when the operation completes or fails.

The completionHandler is passed the attributed string result along with any document-level attributes, or an error.

Source

unsafe fn loadFromHTMLWithFileURL_options_completionHandler( file_url: &NSURL, options: &NSDictionary<NSAttributedStringDocumentReadingOptionKey, AnyObject>, completion_handler: NSAttributedStringCompletionHandler, )

Available on crate feature block2 and crate feature objc2-app-kit and macOS only.

Converts a local HTML file into an attributed string.

Parameter fileURL: The file URL to load.

Parameter options: Document attributes for interpreting the document contents. NSTextSizeMultiplierDocumentOption, NSTimeoutDocumentOption and NSReadAccessURLDocumentOption are supported option keys.

Parameter completionHandler: A block to invoke when the operation completes or fails.

The completionHandler is passed the attributed string result along with any document-level attributes, or an error. If NSReadAccessURLDocumentOption references a single file, only that file may be loaded by WebKit. If NSReadAccessURLDocumentOption references a directory, files inside that directory may be loaded by WebKit.

Source

unsafe fn loadFromHTMLWithString_options_completionHandler( string: &NSString, options: &NSDictionary<NSAttributedStringDocumentReadingOptionKey, AnyObject>, completion_handler: NSAttributedStringCompletionHandler, )

Available on crate feature block2 and crate feature objc2-app-kit and macOS only.

Converts an HTML string into an attributed string.

Parameter string: The HTML string to use as the contents.

Parameter options: Document attributes for interpreting the document contents. NSTextSizeMultiplierDocumentOption, NSTimeoutDocumentOption and NSBaseURLDocumentOption are supported option keys.

Parameter completionHandler: A block to invoke when the operation completes or fails.

The completionHandler is passed the attributed string result along with any document-level attributes, or an error. NSBaseURLDocumentOption is used to resolve relative URLs within the document.

Source

unsafe fn loadFromHTMLWithData_options_completionHandler( data: &NSData, options: &NSDictionary<NSAttributedStringDocumentReadingOptionKey, AnyObject>, completion_handler: NSAttributedStringCompletionHandler, )

Available on crate feature block2 and crate feature objc2-app-kit and macOS only.

Converts HTML data into an attributed string.

Parameter data: The HTML data to use as the contents.

Parameter options: Document attributes for interpreting the document contents. NSTextSizeMultiplierDocumentOption, NSTimeoutDocumentOption, NSTextEncodingNameDocumentOption, and NSCharacterEncodingDocumentOption are supported option keys.

Parameter completionHandler: A block to invoke when the operation completes or fails.

The completionHandler is passed the attributed string result along with any document-level attributes, or an error. If neither NSTextEncodingNameDocumentOption nor NSCharacterEncodingDocumentOption is supplied, a best-guess encoding is used.

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 NSAttributedStringWebKitAdditions for NSAttributedString

Implementors§