objc2-core-spotlight 0.3.2

Bindings to the CoreSpotlight framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corespotlight/cssuggestionhighlightattributename?language=objc)
    pub static CSSuggestionHighlightAttributeName: &'static NSAttributedStringKey;
}

/// [Apple's documentation](https://developer.apple.com/documentation/corespotlight/cssuggestionkind?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct CSSuggestionKind(pub NSInteger);
impl CSSuggestionKind {
    #[doc(alias = "CSSuggestionKindNone")]
    pub const None: Self = Self(0);
    #[doc(alias = "CSSuggestionKindCustom")]
    pub const Custom: Self = Self(1);
    #[doc(alias = "CSSuggestionKindDefault")]
    pub const Default: Self = Self(2);
}

unsafe impl Encode for CSSuggestionKind {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for CSSuggestionKind {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/corespotlight/cssuggestion?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct CSSuggestion;
);

extern_conformance!(
    unsafe impl NSCoding for CSSuggestion {}
);

extern_conformance!(
    unsafe impl NSCopying for CSSuggestion {}
);

unsafe impl CopyingHelper for CSSuggestion {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSObjectProtocol for CSSuggestion {}
);

extern_conformance!(
    unsafe impl NSSecureCoding for CSSuggestion {}
);

impl CSSuggestion {
    extern_methods!(
        #[unsafe(method(localizedAttributedSuggestion))]
        #[unsafe(method_family = none)]
        pub unsafe fn localizedAttributedSuggestion(&self) -> Retained<NSAttributedString>;

        #[unsafe(method(suggestionKind))]
        #[unsafe(method_family = none)]
        pub unsafe fn suggestionKind(&self) -> CSSuggestionKind;

        #[unsafe(method(compareByRank:))]
        #[unsafe(method_family = none)]
        pub unsafe fn compareByRank(&self, other: &CSSuggestion) -> NSComparisonResult;

        #[unsafe(method(compare:))]
        #[unsafe(method_family = none)]
        pub unsafe fn compare(&self, other: &CSSuggestion) -> NSComparisonResult;
    );
}

/// Methods declared on superclass `NSObject`.
impl CSSuggestion {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}