//! An RDMA library consisting of safe RDMA wrappings and several useful
//! functionalities to build RDMA connections.
//!
//! This library respects existing installation of MLNX_OFED or ibverbs.
//! Depending on the environment, it will enable `ibv_exp_*` or RDMA-Core
//! features correspondingly. You may build the documentation in your
//! own environment to see which features are enabled.
//!
//! # Example
//!
//! This example sends and receives a message via RDMA RC QPs.
//!
//! ```rust
#![doc = include_str!("../examples/local_rc_sendrecv.rs")]
//! ```

#[cfg(not(target_os = "linux"))]
compile_error!("`rrddmma` currently only supports Linux");

/// Bindings of C interfaces.
pub mod bindings;

/// Shared utility functions.
mod utils;

/// RDMA functionalities.
/// Not to be publicly exposed, instead `pub use` necessary items.
mod rdma;

pub use rdma::context::Context;
pub use rdma::cq::{Cq, Wc, WcOpcode, WcStatus};
pub use rdma::gid::{Gid, GidType, GidTyped};
pub use rdma::mr::{Mr, MrRemote, MrSlice, Slicing};
pub use rdma::nic::{Nic, NicFinder, Port, PortLinkLayer, PortMtu, PortSpeed, PortState};
pub use rdma::pd::Pd;
pub use rdma::qp::{Qp, QpBuilder, QpCaps, QpEndpoint, QpPeer, QpState, QpType};
pub use rdma::wr::*;

/// Error types generated by RDMA functionalities.
pub mod errors {
    pub use super::rdma::cq::CqCreationError;
    pub use super::rdma::gid::GidQueryError;
    pub use super::rdma::nic::{NicProbeError, PortQueryError};
    pub use super::rdma::qp::QpCreationError;
}

/// Type aliases and re-exports for RDMA-related operations.
pub use rdma::type_alias;

/// Connection management utilities.
pub mod ctrl;

/// Higher-level wrappings of RDMA resources.
pub mod wrap;
