Skip to main content

ibverbs_rs/channel/ops/
scoped_ops.rs

1use crate::channel::polling_scope::*;
2use crate::channel::{Channel, TransportResult};
3use crate::ibverbs::work::{
4    ReadWorkRequest, ReceiveWorkRequest, SendWorkRequest, WriteWorkRequest,
5};
6
7impl<'scope, 'env> PollingScope<'scope, 'env, Channel> {
8    /// Posts a send operation, returning a handle for manual polling.
9    pub fn post_send(
10        &mut self,
11        wr: SendWorkRequest<'_, 'env>,
12    ) -> TransportResult<ScopedPendingWork<'scope>> {
13        Ok(self.channel_post_send(|s| Ok(s), wr)?)
14    }
15
16    /// Posts a receive operation, returning a handle for manual polling.
17    pub fn post_receive(
18        &mut self,
19        wr: ReceiveWorkRequest<'_, 'env>,
20    ) -> TransportResult<ScopedPendingWork<'scope>> {
21        Ok(self.channel_post_receive(|s| Ok(s), wr)?)
22    }
23
24    /// Posts an RDMA write operation, returning a handle for manual polling.
25    pub fn post_write(
26        &mut self,
27        wr: WriteWorkRequest<'_, 'env>,
28    ) -> TransportResult<ScopedPendingWork<'scope>> {
29        Ok(self.channel_post_write(|s| Ok(s), wr)?)
30    }
31
32    /// Posts an RDMA read operation, returning a handle for manual polling.
33    pub fn post_read(
34        &mut self,
35        wr: ReadWorkRequest<'_, 'env>,
36    ) -> TransportResult<ScopedPendingWork<'scope>> {
37        Ok(self.channel_post_read(|s| Ok(s), wr)?)
38    }
39}