Source code

Revision control

Copy as Markdown

Other Tools

//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use crate::*;
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "NSUnit")]
pub struct NSMeasurement<UnitType: ?Sized = AnyObject>;
);
#[cfg(feature = "NSUnit")]
impl<UnitType: ?Sized + Message + AsRef<NSUnit>> NSMeasurement<UnitType> {
/// Unchecked conversion of the generic parameter.
///
/// # Safety
///
/// The generic must be valid to reinterpret as the given type.
#[inline]
pub unsafe fn cast_unchecked<NewUnitType: ?Sized + Message + AsRef<NSUnit>>(
&self,
) -> &NSMeasurement<NewUnitType> {
unsafe { &*((self as *const Self).cast()) }
}
}
#[cfg(all(feature = "NSObject", feature = "NSUnit"))]
extern_conformance!(
unsafe impl<UnitType: ?Sized + NSCoding + AsRef<NSUnit>> NSCoding for NSMeasurement<UnitType> {}
);
#[cfg(all(feature = "NSObject", feature = "NSUnit"))]
extern_conformance!(
unsafe impl<UnitType: ?Sized + AsRef<NSUnit>> NSCopying for NSMeasurement<UnitType> {}
);
#[cfg(all(feature = "NSObject", feature = "NSUnit"))]
unsafe impl<UnitType: ?Sized + Message + AsRef<NSUnit>> CopyingHelper for NSMeasurement<UnitType> {
type Result = Self;
}
#[cfg(feature = "NSUnit")]
extern_conformance!(
unsafe impl<UnitType: ?Sized + AsRef<NSUnit>> NSObjectProtocol for NSMeasurement<UnitType> {}
);
#[cfg(all(feature = "NSObject", feature = "NSUnit"))]
extern_conformance!(
unsafe impl<UnitType: ?Sized + NSSecureCoding + AsRef<NSUnit>> NSSecureCoding
for NSMeasurement<UnitType>
{
}
);
#[cfg(feature = "NSUnit")]
impl<UnitType: Message + AsRef<NSUnit>> NSMeasurement<UnitType> {
extern_methods!(
#[unsafe(method(unit))]
#[unsafe(method_family = none)]
pub fn unit(&self) -> Retained<UnitType>;
#[unsafe(method(doubleValue))]
#[unsafe(method_family = none)]
pub fn doubleValue(&self) -> c_double;
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(initWithDoubleValue:unit:))]
#[unsafe(method_family = init)]
pub fn initWithDoubleValue_unit(
this: Allocated<Self>,
double_value: c_double,
unit: &UnitType,
) -> Retained<Self>;
#[unsafe(method(canBeConvertedToUnit:))]
#[unsafe(method_family = none)]
pub fn canBeConvertedToUnit(&self, unit: &NSUnit) -> bool;
#[unsafe(method(measurementByConvertingToUnit:))]
#[unsafe(method_family = none)]
pub fn measurementByConvertingToUnit(&self, unit: &NSUnit) -> Retained<NSMeasurement>;
#[unsafe(method(measurementByAddingMeasurement:))]
#[unsafe(method_family = none)]
pub fn measurementByAddingMeasurement(
&self,
measurement: &NSMeasurement<UnitType>,
) -> Retained<NSMeasurement<UnitType>>;
#[unsafe(method(measurementBySubtractingMeasurement:))]
#[unsafe(method_family = none)]
pub fn measurementBySubtractingMeasurement(
&self,
measurement: &NSMeasurement<UnitType>,
) -> Retained<NSMeasurement<UnitType>>;
);
}
/// Methods declared on superclass `NSObject`.
#[cfg(feature = "NSUnit")]
impl<UnitType: Message + AsRef<NSUnit>> NSMeasurement<UnitType> {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}