#[unsafe(no_mangle)]pub unsafe extern "C" fn hurray_tensor_descriptor(
handle: *const HurrayTensor,
out_descriptor: *mut *mut HurrayDescriptor,
) -> HurrayStatusExpand description
Borrows the tensor’s descriptor handle.
The returned handle carries every accessor in crate::descriptor and
crate::field. It is borrowed: the caller MUST NOT call
hurray_descriptor_destroy on it, and MUST keep the tensor alive while it reads.
§Safety
handle and out_descriptor MUST be valid, non-null pointers.
§Examples
use hurray_ffi::descriptor::hurray_descriptor_rank;
use hurray_ffi::tensor::{hurray_tensor_descriptor, hurray_tensor_destroy, hurray_tensor_new};
use hurray_ffi::{
hurray_buffer_list_new, HurrayBufferList, HurrayDescriptor, HurrayTensor,
HURRAY_C_ABI_VERSION, HURRAY_OK,
};
let mut descriptor: *mut HurrayDescriptor = std::ptr::null_mut();
assert_eq!(
unsafe { hurray_tensor_descriptor(tensor, &mut descriptor) },
HURRAY_OK,
);
let mut rank: u32 = 0;
unsafe { hurray_descriptor_rank(descriptor, &mut rank) };
assert_eq!(rank, 1);