objc2_metric_kit/generated/
MXAverage.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_class!(
11    /// A class representing metric data that is averaged.
12    ///
13    /// See also [Apple's documentation](https://developer.apple.com/documentation/metrickit/mxaverage?language=objc)
14    #[unsafe(super(NSObject))]
15    #[derive(Debug, PartialEq, Eq, Hash)]
16    pub struct MXAverage<UnitType: ?Sized = AnyObject>;
17);
18
19impl<UnitType: ?Sized + Message + AsRef<NSUnit>> MXAverage<UnitType> {
20    /// Unchecked conversion of the generic parameter.
21    ///
22    /// # Safety
23    ///
24    /// The generic must be valid to reinterpret as the given type.
25    #[inline]
26    pub unsafe fn cast_unchecked<NewUnitType: ?Sized + Message + AsRef<NSUnit>>(
27        &self,
28    ) -> &MXAverage<NewUnitType> {
29        unsafe { &*((self as *const Self).cast()) }
30    }
31}
32
33extern_conformance!(
34    unsafe impl<UnitType: ?Sized + NSCoding + AsRef<NSUnit>> NSCoding for MXAverage<UnitType> {}
35);
36
37extern_conformance!(
38    unsafe impl<UnitType: ?Sized + AsRef<NSUnit>> NSObjectProtocol for MXAverage<UnitType> {}
39);
40
41extern_conformance!(
42    unsafe impl<UnitType: ?Sized + NSSecureCoding + AsRef<NSUnit>> NSSecureCoding
43        for MXAverage<UnitType>
44    {
45    }
46);
47
48impl<UnitType: Message + AsRef<NSUnit>> MXAverage<UnitType> {
49    extern_methods!(
50        /// An NSMeasurement that contains the average measurement.
51        #[unsafe(method(averageMeasurement))]
52        #[unsafe(method_family = none)]
53        pub unsafe fn averageMeasurement(&self) -> Retained<NSMeasurement<UnitType>>;
54
55        /// An NSInteger representation of the number of samples in the distribution used to formulate the average.
56        ///
57        /// This value is negative if an unknown number of samples was used to compute the average.
58        #[unsafe(method(sampleCount))]
59        #[unsafe(method_family = none)]
60        pub unsafe fn sampleCount(&self) -> NSInteger;
61
62        /// An double representation of the standard deviation of the distribution.
63        ///
64        /// This value is negative an unknown number of samples was used to compute the standard deviation.
65        #[unsafe(method(standardDeviation))]
66        #[unsafe(method_family = none)]
67        pub unsafe fn standardDeviation(&self) -> c_double;
68    );
69}
70
71/// Methods declared on superclass `NSObject`.
72impl<UnitType: Message + AsRef<NSUnit>> MXAverage<UnitType> {
73    extern_methods!(
74        #[unsafe(method(init))]
75        #[unsafe(method_family = init)]
76        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
77
78        #[unsafe(method(new))]
79        #[unsafe(method_family = new)]
80        pub unsafe fn new() -> Retained<Self>;
81    );
82}