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_protocol!(
pub unsafe trait NSLocking {
#[unsafe(method(lock))]
#[unsafe(method_family = none)]
unsafe fn lock(&self);
#[unsafe(method(unlock))]
#[unsafe(method_family = none)]
unsafe fn unlock(&self);
}
);
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSLock;
);
unsafe impl Send for NSLock {}
unsafe impl Sync for NSLock {}
extern_conformance!(
unsafe impl NSLocking for NSLock {}
);
extern_conformance!(
unsafe impl NSObjectProtocol for NSLock {}
);
impl NSLock {
extern_methods!(
#[unsafe(method(tryLock))]
#[unsafe(method_family = none)]
pub unsafe fn tryLock(&self) -> bool;
#[cfg(feature = "NSDate")]
#[unsafe(method(lockBeforeDate:))]
#[unsafe(method_family = none)]
pub unsafe fn lockBeforeDate(&self, limit: &NSDate) -> bool;
#[cfg(feature = "NSString")]
#[unsafe(method(name))]
#[unsafe(method_family = none)]
pub fn name(&self) -> Option<Retained<NSString>>;
#[cfg(feature = "NSString")]
/// Setter for [`name`][Self::name].
///
/// This is [copied][crate::NSCopying::copy] when set.
#[unsafe(method(setName:))]
#[unsafe(method_family = none)]
pub fn setName(&self, name: Option<&NSString>);
);
}
/// Methods declared on superclass `NSObject`.
impl NSLock {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}
impl DefaultRetained for NSLock {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSConditionLock;
);
unsafe impl Send for NSConditionLock {}
unsafe impl Sync for NSConditionLock {}
extern_conformance!(
unsafe impl NSLocking for NSConditionLock {}
);
extern_conformance!(
unsafe impl NSObjectProtocol for NSConditionLock {}
);
impl NSConditionLock {
extern_methods!(
#[unsafe(method(initWithCondition:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithCondition(
this: Allocated<Self>,
condition: NSInteger,
) -> Retained<Self>;
#[unsafe(method(condition))]
#[unsafe(method_family = none)]
pub unsafe fn condition(&self) -> NSInteger;
#[unsafe(method(lockWhenCondition:))]
#[unsafe(method_family = none)]
pub unsafe fn lockWhenCondition(&self, condition: NSInteger);
#[unsafe(method(tryLock))]
#[unsafe(method_family = none)]
pub unsafe fn tryLock(&self) -> bool;
#[unsafe(method(tryLockWhenCondition:))]
#[unsafe(method_family = none)]
pub unsafe fn tryLockWhenCondition(&self, condition: NSInteger) -> bool;
#[unsafe(method(unlockWithCondition:))]
#[unsafe(method_family = none)]
pub unsafe fn unlockWithCondition(&self, condition: NSInteger);
#[cfg(feature = "NSDate")]
#[unsafe(method(lockBeforeDate:))]
#[unsafe(method_family = none)]
pub unsafe fn lockBeforeDate(&self, limit: &NSDate) -> bool;
#[cfg(feature = "NSDate")]
#[unsafe(method(lockWhenCondition:beforeDate:))]
#[unsafe(method_family = none)]
pub unsafe fn lockWhenCondition_beforeDate(
&self,
condition: NSInteger,
limit: &NSDate,
) -> bool;
#[cfg(feature = "NSString")]
#[unsafe(method(name))]
#[unsafe(method_family = none)]
pub unsafe fn name(&self) -> Option<Retained<NSString>>;
#[cfg(feature = "NSString")]
/// Setter for [`name`][Self::name].
///
/// This is [copied][crate::NSCopying::copy] when set.
#[unsafe(method(setName:))]
#[unsafe(method_family = none)]
pub unsafe fn setName(&self, name: Option<&NSString>);
);
}
/// Methods declared on superclass `NSObject`.
impl NSConditionLock {
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>;
);
}
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSRecursiveLock;
);
unsafe impl Send for NSRecursiveLock {}
unsafe impl Sync for NSRecursiveLock {}
extern_conformance!(
unsafe impl NSLocking for NSRecursiveLock {}
);
extern_conformance!(
unsafe impl NSObjectProtocol for NSRecursiveLock {}
);
impl NSRecursiveLock {
extern_methods!(
#[unsafe(method(tryLock))]
#[unsafe(method_family = none)]
pub unsafe fn tryLock(&self) -> bool;
#[cfg(feature = "NSDate")]
#[unsafe(method(lockBeforeDate:))]
#[unsafe(method_family = none)]
pub unsafe fn lockBeforeDate(&self, limit: &NSDate) -> bool;
#[cfg(feature = "NSString")]
#[unsafe(method(name))]
#[unsafe(method_family = none)]
pub unsafe fn name(&self) -> Option<Retained<NSString>>;
#[cfg(feature = "NSString")]
/// Setter for [`name`][Self::name].
///
/// This is [copied][crate::NSCopying::copy] when set.
#[unsafe(method(setName:))]
#[unsafe(method_family = none)]
pub unsafe fn setName(&self, name: Option<&NSString>);
);
}
/// Methods declared on superclass `NSObject`.
impl NSRecursiveLock {
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>;
);
}
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSCondition;
);
unsafe impl Send for NSCondition {}
unsafe impl Sync for NSCondition {}
extern_conformance!(
unsafe impl NSLocking for NSCondition {}
);
extern_conformance!(
unsafe impl NSObjectProtocol for NSCondition {}
);
impl NSCondition {
extern_methods!(
#[unsafe(method(wait))]
#[unsafe(method_family = none)]
pub unsafe fn wait(&self);
#[cfg(feature = "NSDate")]
#[unsafe(method(waitUntilDate:))]
#[unsafe(method_family = none)]
pub unsafe fn waitUntilDate(&self, limit: &NSDate) -> bool;
#[unsafe(method(signal))]
#[unsafe(method_family = none)]
pub unsafe fn signal(&self);
#[unsafe(method(broadcast))]
#[unsafe(method_family = none)]
pub unsafe fn broadcast(&self);
#[cfg(feature = "NSString")]
#[unsafe(method(name))]
#[unsafe(method_family = none)]
pub unsafe fn name(&self) -> Option<Retained<NSString>>;
#[cfg(feature = "NSString")]
/// Setter for [`name`][Self::name].
///
/// This is [copied][crate::NSCopying::copy] when set.
#[unsafe(method(setName:))]
#[unsafe(method_family = none)]
pub unsafe fn setName(&self, name: Option<&NSString>);
);
}
/// Methods declared on superclass `NSObject`.
impl NSCondition {
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>;
);
}