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 #[deprecated]
60 #[unsafe(method(dataWithBytesNoCopy:length:))]
61 #[unsafe(method_family = none)]
62 pub unsafe fn dataWithBytesNoCopy_length(
63 bytes: NonNull<c_void>,
64 length: NSUInteger,
65 ) -> Retained<Self>;
66
67 /// Creates a data object that holds a given number of bytes from a given buffer.
68 ///
69 /// Note: The returned object will not take ownership of the
70 /// `bytes`pointer and thus will not free it on deallocation. The underlying bytes in the return object should not be mutated.
71 ///
72 /// Parameter `bytes`: A buffer containing data for the new object.
73 ///
74 /// Parameter `length`: The number of bytes to hold from
75 /// `bytes.`This value must not exceed the length of
76 /// `bytes.`
77 /// Returns: A new
78 /// `MLCTensorData`object.
79 #[deprecated]
80 #[unsafe(method(dataWithImmutableBytesNoCopy:length:))]
81 #[unsafe(method_family = none)]
82 pub unsafe fn dataWithImmutableBytesNoCopy_length(
83 bytes: NonNull<c_void>,
84 length: NSUInteger,
85 ) -> Retained<Self>;
86
87 #[cfg(feature = "block2")]
88 /// Creates a data object that holds a given number of bytes from a given buffer. with a custom deallocator block.
89 ///
90 /// Parameter `bytes`: A buffer containing data for the new object.
91 ///
92 /// Parameter `length`: The number of bytes to hold from
93 /// `bytes.`This value must not exceed the length of
94 /// `bytes.`
95 /// Parameter `deallocator`: A block to invoke when the resulting object is deallocated.
96 ///
97 /// Returns: A new
98 /// `MLCTensorData`object.
99 #[unsafe(method(dataWithBytesNoCopy:length:deallocator:))]
100 #[unsafe(method_family = none)]
101 pub unsafe fn dataWithBytesNoCopy_length_deallocator(
102 bytes: NonNull<c_void>,
103 length: NSUInteger,
104 deallocator: &block2::DynBlock<dyn Fn(NonNull<c_void>, NSUInteger)>,
105 ) -> Retained<Self>;
106 );
107}