objc2_ml_compute/generated/MLCTensorData.rs
1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6
7use crate::*;
8
9extern_class!(
10 /// An object to encapsulate memory to be used as tensor data
11 ///
12 /// See also [Apple's documentation](https://developer.apple.com/documentation/mlcompute/mlctensordata?language=objc)
13 #[unsafe(super(NSObject))]
14 #[derive(Debug, PartialEq, Eq, Hash)]
15 #[deprecated]
16 pub struct MLCTensorData;
17);
18
19extern_conformance!(
20 unsafe impl NSObjectProtocol for MLCTensorData {}
21);
22
23impl MLCTensorData {
24 extern_methods!(
25 /// Pointer to memory that contains or will be used for tensor data
26 #[deprecated]
27 #[unsafe(method(bytes))]
28 #[unsafe(method_family = none)]
29 pub unsafe fn bytes(&self) -> NonNull<c_void>;
30
31 /// The size in bytes of the tensor data
32 #[deprecated]
33 #[unsafe(method(length))]
34 #[unsafe(method_family = none)]
35 pub unsafe fn length(&self) -> NSUInteger;
36
37 #[deprecated]
38 #[unsafe(method(new))]
39 #[unsafe(method_family = new)]
40 pub unsafe fn new() -> Retained<Self>;
41
42 #[deprecated]
43 #[unsafe(method(init))]
44 #[unsafe(method_family = init)]
45 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
46
47 /// Creates a data object that holds a given number of bytes from a given buffer.
48 ///
49 /// Note: The returned object will not take ownership of the
50 /// `bytes`pointer and thus will not free it on deallocation.
51 ///
52 /// Parameter `bytes`: A buffer containing data for the new object.
53 ///
54 /// Parameter `length`: The number of bytes to hold from
55 /// `bytes.`This value must not exceed the length of
56 /// `bytes.`
57 /// Returns: A new
58 /// `MLCTensorData`object.
59 ///
60 /// # Safety
61 ///
62 /// `bytes` must be a valid pointer.
63 #[deprecated]
64 #[unsafe(method(dataWithBytesNoCopy:length:))]
65 #[unsafe(method_family = none)]
66 pub unsafe fn dataWithBytesNoCopy_length(
67 bytes: NonNull<c_void>,
68 length: NSUInteger,
69 ) -> Retained<Self>;
70
71 /// Creates a data object that holds a given number of bytes from a given buffer.
72 ///
73 /// Note: The returned object will not take ownership of the
74 /// `bytes`pointer and thus will not free it on deallocation. The underlying bytes in the return object should not be mutated.
75 ///
76 /// Parameter `bytes`: A buffer containing data for the new object.
77 ///
78 /// Parameter `length`: The number of bytes to hold from
79 /// `bytes.`This value must not exceed the length of
80 /// `bytes.`
81 /// Returns: A new
82 /// `MLCTensorData`object.
83 ///
84 /// # Safety
85 ///
86 /// `bytes` must be a valid pointer.
87 #[deprecated]
88 #[unsafe(method(dataWithImmutableBytesNoCopy:length:))]
89 #[unsafe(method_family = none)]
90 pub unsafe fn dataWithImmutableBytesNoCopy_length(
91 bytes: NonNull<c_void>,
92 length: NSUInteger,
93 ) -> Retained<Self>;
94
95 #[cfg(feature = "block2")]
96 /// Creates a data object that holds a given number of bytes from a given buffer. with a custom deallocator block.
97 ///
98 /// Parameter `bytes`: A buffer containing data for the new object.
99 ///
100 /// Parameter `length`: The number of bytes to hold from
101 /// `bytes.`This value must not exceed the length of
102 /// `bytes.`
103 /// Parameter `deallocator`: A block to invoke when the resulting object is deallocated.
104 ///
105 /// Returns: A new
106 /// `MLCTensorData`object.
107 ///
108 /// # Safety
109 ///
110 /// `bytes` must be a valid pointer.
111 #[unsafe(method(dataWithBytesNoCopy:length:deallocator:))]
112 #[unsafe(method_family = none)]
113 pub unsafe fn dataWithBytesNoCopy_length_deallocator(
114 bytes: NonNull<c_void>,
115 length: NSUInteger,
116 deallocator: &block2::DynBlock<dyn Fn(NonNull<c_void>, NSUInteger)>,
117 ) -> Retained<Self>;
118 );
119}