use super::*;
use crate::asyncio::*;
use runng_sys::*;
#[derive(Clone, Debug, NngSetOpts)]
#[prefix = "nng_socket_"]
pub struct Pair1 {
socket: NngSocket,
}
impl Pair1 {
pub fn open() -> Result<Self> {
nng_open(
|socket: &mut nng_socket| unsafe { nng_pair1_open(socket) },
|socket| Pair1 { socket },
)
}
}
impl GetSocket for Pair1 {
fn socket(&self) -> &NngSocket {
&self.socket
}
fn socket_mut(&mut self) -> &mut NngSocket {
&mut self.socket
}
}
impl Socket for Pair1 {}
impl Dial for Pair1 {}
impl Listen for Pair1 {}
impl SendSocket for Pair1 {}
impl RecvSocket for Pair1 {}
impl AsyncSocket for Pair1 {
type ContextType = PairAsyncHandle;
}
impl AsyncStream for Pair1 {
type ContextType = PairStreamHandle;
}