pub fn subscribe(
        self,
        handle: &Handle,
        tp: &Transport,
        subject: &str,
    ) -> Result<AsyncSub, TibrvError> {
        let (registration, ready) = mio::Registration::new2();

        let sub = self.queue.subscribe(tp, subject)?;

        // Set up event hook
        let listener = Box::new(ready);
        let l_ptr = &*listener as *const mio::SetReadiness;
        let result = unsafe {
            tibrvQueue_SetHook(
                sub.queue.inner,
                Some(AsyncQueue::callback),
                l_ptr as *mut ::std::os::raw::c_void,
            )
        };
        if result != TIBRV_OK {
            Err(ErrorKind::AsyncRegError)?;
        };

        Ok(AsyncSub {
            sub,
            io: PollEvented2::new_with_handle(registration, handle)
                .context(ErrorKind::AsyncRegError)?,
            _listener: listener,
        })
    }
/// Asynchronously subscribe to a message subject.
///
/// Sets up the channels as in a synchronous subscription and returns
/// an `AsyncSub` stream.
Asynchronously subscribe to a message subject.
Sets up the channels as in a synchronous subscription and returns
an `AsyncSub` stream.
Asynchronously subscribe to a message subject . Sets up the channels as in a synchronous subscription and returns an ` AsyncSub ` stream .
pub fn subscribe(
        self,
        handle: &Handle,
        tp: &Transport,
        subject: &str,
    ) -> Result<AsyncSub, TibrvError> {
        let (registration, ready) = mio::Registration::new2();
        let sub = self.queue.subscribe(tp, subject)?;
        // Set up event hook
        let listener = Box::new(ready);
        let l_ptr = &*listener as *const mio::SetReadiness;
        let result = unsafe {
            tibrvQueue_SetHook(
                sub.queue.inner,
                Some(AsyncQueue::callback),
                l_ptr as *mut ::std::os::raw::c_void,
            )
        };
        if result != TIBRV_OK {
            Err(ErrorKind::AsyncRegError)?;
        };
        Ok(AsyncSub {
            sub,
            io: PollEvented2::new_with_handle(registration, handle)
                .context(ErrorKind::AsyncRegError)?,
            _listener: listener,
        })
    }
pub fn subscribe ( self , handle : & Handle , tp : & Transport , subject : & str , ) -> Result < AsyncSub , TibrvError > { let ( registration , ready ) = mio :: Registration :: new2 ( ) ; let sub = self . queue . subscribe ( tp , subject ) ? ; // Set up event hook let listener = Box :: new ( ready ) ; let l_ptr = & * listener as * const mio :: SetReadiness ; let result = unsafe { tibrvQueue_SetHook ( sub . queue . inner , Some ( AsyncQueue :: callback ) , l_ptr as * mut :: std :: os :: raw :: c_void , ) } ; if result != TIBRV_OK { Err ( ErrorKind :: AsyncRegError ) ? ; } ; Ok ( AsyncSub { sub , io : PollEvented2 :: new_with_handle ( registration , handle ) . context ( ErrorKind :: AsyncRegError ) ? , _listener : listener , } ) }
Asynchronously subscribe to a message subject.
Asynchronously subscribe to a message subject .
self
handle
&Handle
tp
&Transport
subject
&str
self
handle
&Handle
tp
&Transport
subject
&str