pub fn cast(self, server: SocketAddr, notification: T::Notification) -> Result<()> {
        if !self
            .options
            .is_allowable_queue_len(&self.service.metrics, server)
        {
            self.service.metrics.discarded_outgoing_messages.increment();
            let e = track!(ErrorKind::Unavailable.cause("too long transmit queue"));
            return Err(e.into());
        }

        let header = MessageHeader {
            id: MessageId(0), // dummy
            procedure: T::ID,
            priority: self.options.priority,
            is_async: T::enable_async(&notification),
        };
        let message = Message {
            message: OutgoingMessage {
                header,
                payload: OutgoingMessagePayload::with_item(self.encoder, notification),
            },
            response_handler: None,
            force_wakeup: self.options.force_wakeup,
        };
        if !self.service.send_message(server, message) {
            self.service.metrics.discarded_outgoing_messages.increment();
            let e = track!(ErrorKind::Unavailable.cause("client service or server is unavailable"));
            return Err(e.into());
        }

        self.service.metrics.notifications.increment();
        Ok(())
    }
/// Sends the notification message to the RPC server.
Sends the notification message to the RPC server.
Sends the notification message to the RPC server .
pub fn cast(self, server: SocketAddr, notification: T::Notification) -> Result<()> {
        if !self
            .options
            .is_allowable_queue_len(&self.service.metrics, server)
        {
            self.service.metrics.discarded_outgoing_messages.increment();
            let e = track!(ErrorKind::Unavailable.cause("too long transmit queue"));
            return Err(e.into());
        }
        let header = MessageHeader {
            id: MessageId(0), // dummy
            procedure: T::ID,
            priority: self.options.priority,
            is_async: T::enable_async(&notification),
        };
        let message = Message {
            message: OutgoingMessage {
                header,
                payload: OutgoingMessagePayload::with_item(self.encoder, notification),
            },
            response_handler: None,
            force_wakeup: self.options.force_wakeup,
        };
        if !self.service.send_message(server, message) {
            self.service.metrics.discarded_outgoing_messages.increment();
            let e = track!(ErrorKind::Unavailable.cause("client service or server is unavailable"));
            return Err(e.into());
        }
        self.service.metrics.notifications.increment();
        Ok(())
    }
pub fn cast ( self , server : SocketAddr , notification : T :: Notification ) -> Result < ( ) > { if ! self . options . is_allowable_queue_len ( & self . service . metrics , server ) { self . service . metrics . discarded_outgoing_messages . increment ( ) ; let e = track ! ( ErrorKind Unavailable cause ( " " ) ) ; return Err ( e . into ( ) ) ; } let header = MessageHeader { id : MessageId ( 0 ) , // dummy procedure : T :: ID , priority : self . options . priority , is_async : T :: enable_async ( & notification ) , } ; let message = Message { message : OutgoingMessage { header , payload : OutgoingMessagePayload :: with_item ( self . encoder , notification ) , } , response_handler : None , force_wakeup : self . options . force_wakeup , } ; if ! self . service . send_message ( server , message ) { self . service . metrics . discarded_outgoing_messages . increment ( ) ; let e = track ! ( ErrorKind Unavailable cause ( " " ) ) ; return Err ( e . into ( ) ) ; } self . service . metrics . notifications . increment ( ) ; Ok ( ( ) ) }
Sends the notification message to the RPC server.
Sends the notification message to the RPC server .
self
server
SocketAddr
notification
T::Notification
self
server
SocketAddr
notification
T::Notification