objc2-ml-compute 0.3.2

Bindings to the MLCompute 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 crate::*;

extern_class!(
    /// An object to encapsulate memory to be used as tensor data
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/mlcompute/mlctensordata?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[deprecated]
    pub struct MLCTensorData;
);

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

impl MLCTensorData {
    extern_methods!(
        /// Pointer to memory that contains or will be used for tensor data
        #[deprecated]
        #[unsafe(method(bytes))]
        #[unsafe(method_family = none)]
        pub unsafe fn bytes(&self) -> NonNull<c_void>;

        /// The size in bytes of the tensor data
        #[deprecated]
        #[unsafe(method(length))]
        #[unsafe(method_family = none)]
        pub unsafe fn length(&self) -> NSUInteger;

        #[deprecated]
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;

        #[deprecated]
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        /// Creates a data object that holds a given number of bytes from a given buffer.
        ///
        /// Note: The returned object will not take ownership of the
        /// `bytes`pointer and thus will not free it on deallocation.
        ///
        /// Parameter `bytes`: A buffer containing data for the new object.
        ///
        /// Parameter `length`: The number of bytes to hold from
        /// `bytes.`This value must not exceed the length of
        /// `bytes.`
        /// Returns: A new
        /// `MLCTensorData`object.
        ///
        /// # Safety
        ///
        /// `bytes` must be a valid pointer.
        #[deprecated]
        #[unsafe(method(dataWithBytesNoCopy:length:))]
        #[unsafe(method_family = none)]
        pub unsafe fn dataWithBytesNoCopy_length(
            bytes: NonNull<c_void>,
            length: NSUInteger,
        ) -> Retained<Self>;

        /// Creates a data object that holds a given number of bytes from a given buffer.
        ///
        /// Note: The returned object will not take ownership of the
        /// `bytes`pointer and thus will not free it on deallocation. The underlying bytes in the return object should not be mutated.
        ///
        /// Parameter `bytes`: A buffer containing data for the new object.
        ///
        /// Parameter `length`: The number of bytes to hold from
        /// `bytes.`This value must not exceed the length of
        /// `bytes.`
        /// Returns: A new
        /// `MLCTensorData`object.
        ///
        /// # Safety
        ///
        /// `bytes` must be a valid pointer.
        #[deprecated]
        #[unsafe(method(dataWithImmutableBytesNoCopy:length:))]
        #[unsafe(method_family = none)]
        pub unsafe fn dataWithImmutableBytesNoCopy_length(
            bytes: NonNull<c_void>,
            length: NSUInteger,
        ) -> Retained<Self>;

        #[cfg(feature = "block2")]
        /// Creates a data object that holds a given number of bytes from a given buffer. with a custom deallocator block.
        ///
        /// Parameter `bytes`: A buffer containing data for the new object.
        ///
        /// Parameter `length`: The number of bytes to hold from
        /// `bytes.`This value must not exceed the length of
        /// `bytes.`
        /// Parameter `deallocator`: A block to invoke when the resulting object is deallocated.
        ///
        /// Returns: A new
        /// `MLCTensorData`object.
        ///
        /// # Safety
        ///
        /// `bytes` must be a valid pointer.
        #[unsafe(method(dataWithBytesNoCopy:length:deallocator:))]
        #[unsafe(method_family = none)]
        pub unsafe fn dataWithBytesNoCopy_length_deallocator(
            bytes: NonNull<c_void>,
            length: NSUInteger,
            deallocator: &block2::DynBlock<dyn Fn(NonNull<c_void>, NSUInteger)>,
        ) -> Retained<Self>;
    );
}