Skip to content

Commit

Permalink
add a little example
Browse files Browse the repository at this point in the history
  • Loading branch information
my-vegetable-has-exploded committed Aug 21, 2023
1 parent 5bdfceb commit 5f28620
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions examples/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,13 @@ async fn send_data_to_server(rdma: &Rdma) -> io::Result<()> {
async fn send_data_with_imm_to_server(rdma: &Rdma) -> io::Result<()> {
// alloc 8 bytes local memory
let mut lmr = rdma.alloc_local_mr(Layout::new::<[u8; 8]>())?;
// write data into lmr
let _num = lmr.as_mut_slice().write(&[1_u8; 8])?;
{
// use cursor to append data to lmr
// use this in a scope to unlock lmr automatically
let mut mr_cursor = lmr.as_mut_slice_cursor();
let _num = mr_cursor.write(&[1_u8; 4])?;
let _num = mr_cursor.write(&[1_u8; 4])?;
}
// send data and imm to the remote end
rdma.send_with_imm(&lmr, 1_u32).await?;
Ok(())
Expand Down

0 comments on commit 5f28620

Please sign in to comment.