macro_rules! remote_array_field {
($mr:expr, $T:ty, $index:expr) => { ... };
}Expand description
Creates a RemoteMemoryRegion pointing to the N-th element of a remote array.
Assumes mr points to the start of a remote array of type T. Returns
Some(RemoteMemoryRegion) for the element at index, or None if the
byte offset overflows or falls outside the region’s bounds.
§Returns
Some(RemoteMemoryRegion)— A handle to theindex-th element.None— If the byte offset overflows, exceeds the region length, or the resulting address overflows.
§Example
use ibverbs_rs::ibverbs::memory::RemoteMemoryRegion;
use ibverbs_rs::remote_array_field;
// Remote memory contains: [u64; 10]
let remote_mr = RemoteMemoryRegion::new(0x1000, 80, 0xABCD);
// Get a handle to the 5th element (index 4)
let elem_mr = remote_array_field!(remote_mr, u64, 4_usize).unwrap();
assert_eq!(elem_mr.address(), 0x1020);