objc2_shazam_kit/generated/
SHSignature.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5use objc2_foundation::*;
6
7use crate::*;
8
9extern_class!(
10    /// An object that contains the opaque data and other information for a signature.
11    ///
12    /// Save your signature to a file and share it with others by writing the data to a file. You can use the saved signatures of reference recordings to populate a custom catalog.
13    ///
14    /// Check whether your captured query signature is long enough to search for a match by comparing ``duration`` to the ``SHCatalog/minimumQuerySignatureDuration`` and ``SHCatalog/maximumQuerySignatureDuration`` of a catalog.
15    ///
16    /// See also [Apple's documentation](https://developer.apple.com/documentation/shazamkit/shsignature?language=objc)
17    #[unsafe(super(NSObject))]
18    #[derive(Debug, PartialEq, Eq, Hash)]
19    pub struct SHSignature;
20);
21
22unsafe impl Send for SHSignature {}
23
24unsafe impl Sync for SHSignature {}
25
26extern_conformance!(
27    unsafe impl NSCoding for SHSignature {}
28);
29
30extern_conformance!(
31    unsafe impl NSCopying for SHSignature {}
32);
33
34unsafe impl CopyingHelper for SHSignature {
35    type Result = Self;
36}
37
38extern_conformance!(
39    unsafe impl NSObjectProtocol for SHSignature {}
40);
41
42extern_conformance!(
43    unsafe impl NSSecureCoding for SHSignature {}
44);
45
46impl SHSignature {
47    extern_methods!(
48        /// The duration of the audio you use to generate the signature.
49        ///
50        /// Audio that contains periods of silence may result in a duration value that's shorter than the full duration of the original audio track.
51        #[unsafe(method(duration))]
52        #[unsafe(method_family = none)]
53        pub unsafe fn duration(&self) -> NSTimeInterval;
54
55        /// The raw data for the signature.
56        #[unsafe(method(dataRepresentation))]
57        #[unsafe(method_family = none)]
58        pub unsafe fn dataRepresentation(&self) -> Retained<NSData>;
59
60        /// Creates a signature object from raw data.
61        ///
62        /// - Parameters:
63        /// - dataRepresentation: The raw data for the signature.
64        /// - error: The error that occurs; otherwise, `nil`.
65        ///
66        /// - Returns: A signature if the raw data is a valid signature; otherwise, `nil`.
67        #[unsafe(method(signatureWithDataRepresentation:error:_))]
68        #[unsafe(method_family = none)]
69        pub unsafe fn signatureWithDataRepresentation_error(
70            data_representation: &NSData,
71        ) -> Result<Retained<SHSignature>, Retained<NSError>>;
72
73        /// Creates a signature object from raw data.
74        ///
75        /// - Parameters:
76        /// - dataRepresentation: The raw data for the signature.
77        /// - error: The error that occurs; otherwise, `nil`.
78        ///
79        /// - Returns: A signature if the raw data is a valid signature; otherwise, `nil`.
80        #[unsafe(method(initWithDataRepresentation:error:_))]
81        #[unsafe(method_family = init)]
82        pub unsafe fn initWithDataRepresentation_error(
83            this: Allocated<Self>,
84            data_representation: &NSData,
85        ) -> Result<Retained<Self>, Retained<NSError>>;
86    );
87}
88
89/// Methods declared on superclass `NSObject`.
90impl SHSignature {
91    extern_methods!(
92        #[unsafe(method(init))]
93        #[unsafe(method_family = init)]
94        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
95
96        #[unsafe(method(new))]
97        #[unsafe(method_family = new)]
98        pub unsafe fn new() -> Retained<Self>;
99    );
100}