objc2-fs-kit 0.3.2

Bindings to the FSKit framework
Documentation
//! 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 objc2_foundation::*;

use crate::*;

extern_class!(
    /// A base type that identifies containers and volumes.
    ///
    /// An ``FSEntityIdentifier`` is a UUID to identify a container or volume, optionally with eight bytes of qualifying (differentiating) data.
    /// You use the qualifiers in cases in which a file server can receive multiple connections from the same client, which differ by user credentials.
    /// In this case, the identifier for each client is the server's base UUID, and a unique qualifier that differs by client.
    ///
    /// > Important: Don't subclass this class.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/fskit/fsentityidentifier?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct FSEntityIdentifier;
);

extern_conformance!(
    unsafe impl NSCoding for FSEntityIdentifier {}
);

extern_conformance!(
    unsafe impl NSCopying for FSEntityIdentifier {}
);

unsafe impl CopyingHelper for FSEntityIdentifier {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSObjectProtocol for FSEntityIdentifier {}
);

extern_conformance!(
    unsafe impl NSSecureCoding for FSEntityIdentifier {}
);

impl FSEntityIdentifier {
    extern_methods!(
        /// Creates an entity identifier with a random UUID.
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        /// Creates an entity identifier with the given UUID.
        ///
        /// - Parameter uuid: The UUID to use for this identifier.
        #[unsafe(method(initWithUUID:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithUUID(this: Allocated<Self>, uuid: &NSUUID) -> Retained<Self>;

        /// Creates an entity identifier with the given UUID and qualifier data as a 64-bit unsigned integer.
        /// - Parameters:
        /// - uuid: The UUID to use for this identifier.
        /// - qualifier: The data to distinguish entities that otherwise share the same UUID.
        #[unsafe(method(initWithUUID:qualifier:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithUUID_qualifier(
            this: Allocated<Self>,
            uuid: &NSUUID,
            qualifier: u64,
        ) -> Retained<Self>;

        /// Creates an entity identifier with the given UUID and qualifier data.
        ///
        /// - Parameters:
        /// - uuid: The UUID to use for this identifier.
        /// - qualifierData: The data to distinguish entities that otherwise share the same UUID.
        #[unsafe(method(initWithUUID:data:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithUUID_data(
            this: Allocated<Self>,
            uuid: &NSUUID,
            qualifier_data: &NSData,
        ) -> Retained<Self>;

        /// A UUID to uniquely identify this entity.
        #[unsafe(method(uuid))]
        #[unsafe(method_family = none)]
        pub unsafe fn uuid(&self) -> Retained<NSUUID>;

        /// Setter for [`uuid`][Self::uuid].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setUuid:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setUuid(&self, uuid: &NSUUID);

        /// An optional piece of data to distinguish entities that otherwise share the same UUID.
        #[unsafe(method(qualifier))]
        #[unsafe(method_family = none)]
        pub unsafe fn qualifier(&self) -> Option<Retained<NSData>>;

        /// Setter for [`qualifier`][Self::qualifier].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setQualifier:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setQualifier(&self, qualifier: Option<&NSData>);
    );
}

/// Methods declared on superclass `NSObject`.
impl FSEntityIdentifier {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}