objc2_foundation/generated/
NSMeasurement.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6
7use crate::*;
8
9extern_class!(
10 #[unsafe(super(NSObject))]
12 #[derive(Debug, PartialEq, Eq, Hash)]
13 #[cfg(feature = "NSUnit")]
14 pub struct NSMeasurement<UnitType: ?Sized = AnyObject>;
15);
16
17#[cfg(feature = "NSUnit")]
18impl<UnitType: ?Sized + Message + AsRef<NSUnit>> NSMeasurement<UnitType> {
19 #[inline]
25 pub unsafe fn cast_unchecked<NewUnitType: ?Sized + Message + AsRef<NSUnit>>(
26 &self,
27 ) -> &NSMeasurement<NewUnitType> {
28 unsafe { &*((self as *const Self).cast()) }
29 }
30}
31
32#[cfg(all(feature = "NSObject", feature = "NSUnit"))]
33extern_conformance!(
34 unsafe impl<UnitType: ?Sized + NSCoding + AsRef<NSUnit>> NSCoding for NSMeasurement<UnitType> {}
35);
36
37#[cfg(all(feature = "NSObject", feature = "NSUnit"))]
38extern_conformance!(
39 unsafe impl<UnitType: ?Sized + AsRef<NSUnit>> NSCopying for NSMeasurement<UnitType> {}
40);
41
42#[cfg(all(feature = "NSObject", feature = "NSUnit"))]
43unsafe impl<UnitType: ?Sized + Message + AsRef<NSUnit>> CopyingHelper for NSMeasurement<UnitType> {
44 type Result = Self;
45}
46
47#[cfg(feature = "NSUnit")]
48extern_conformance!(
49 unsafe impl<UnitType: ?Sized + AsRef<NSUnit>> NSObjectProtocol for NSMeasurement<UnitType> {}
50);
51
52#[cfg(all(feature = "NSObject", feature = "NSUnit"))]
53extern_conformance!(
54 unsafe impl<UnitType: ?Sized + NSSecureCoding + AsRef<NSUnit>> NSSecureCoding
55 for NSMeasurement<UnitType>
56 {
57 }
58);
59
60#[cfg(feature = "NSUnit")]
61impl<UnitType: Message + AsRef<NSUnit>> NSMeasurement<UnitType> {
62 extern_methods!(
63 #[unsafe(method(unit))]
64 #[unsafe(method_family = none)]
65 pub fn unit(&self) -> Retained<UnitType>;
66
67 #[unsafe(method(doubleValue))]
68 #[unsafe(method_family = none)]
69 pub fn doubleValue(&self) -> c_double;
70
71 #[unsafe(method(init))]
72 #[unsafe(method_family = init)]
73 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
74
75 #[unsafe(method(initWithDoubleValue:unit:))]
76 #[unsafe(method_family = init)]
77 pub fn initWithDoubleValue_unit(
78 this: Allocated<Self>,
79 double_value: c_double,
80 unit: &UnitType,
81 ) -> Retained<Self>;
82
83 #[unsafe(method(canBeConvertedToUnit:))]
84 #[unsafe(method_family = none)]
85 pub fn canBeConvertedToUnit(&self, unit: &NSUnit) -> bool;
86
87 #[unsafe(method(measurementByConvertingToUnit:))]
88 #[unsafe(method_family = none)]
89 pub fn measurementByConvertingToUnit(&self, unit: &NSUnit) -> Retained<NSMeasurement>;
90
91 #[unsafe(method(measurementByAddingMeasurement:))]
92 #[unsafe(method_family = none)]
93 pub fn measurementByAddingMeasurement(
94 &self,
95 measurement: &NSMeasurement<UnitType>,
96 ) -> Retained<NSMeasurement<UnitType>>;
97
98 #[unsafe(method(measurementBySubtractingMeasurement:))]
99 #[unsafe(method_family = none)]
100 pub fn measurementBySubtractingMeasurement(
101 &self,
102 measurement: &NSMeasurement<UnitType>,
103 ) -> Retained<NSMeasurement<UnitType>>;
104 );
105}
106
107#[cfg(feature = "NSUnit")]
109impl<UnitType: Message + AsRef<NSUnit>> NSMeasurement<UnitType> {
110 extern_methods!(
111 #[unsafe(method(new))]
112 #[unsafe(method_family = new)]
113 pub unsafe fn new() -> Retained<Self>;
114 );
115}