1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
//! 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>;
);
}