[−][src]Struct potatonet::client::Client
客户端
Methods
impl Client
[src]
pub async fn connect<A>(addr: A) -> Result<Client, Error> where
A: ToSocketAddrs,
[src]
A: ToSocketAddrs,
连接到消息总线
pub fn node_id(&self) -> NodeId
[src]
获取当前节点id
pub async fn register_service<N>(&'_ self, name: N, id: LocalServiceId) where
N: Into<String>,
[src]
N: Into<String>,
注册服务
pub async fn subscribe<T, F, R>(&'_ self, handler: F) -> SubscribeId where
F: FnMut(T) -> R + Send + 'static,
R: Future<Output = ()> + Send + 'static,
T: Topic,
[src]
F: FnMut(T) -> R + Send + 'static,
R: Future<Output = ()> + Send + 'static,
T: Topic,
订阅消息 如果重复订阅,则会按订阅顺序依次触发回调函数,并不会增加数据传输流量
pub async fn subscribe_with_topic<T, F, R>(
&'_ self,
topic: &'_ str,
handler: F
) -> SubscribeId where
F: FnMut(T) -> R + Send + 'static,
R: Future<Output = ()> + Send + 'static,
T: Topic,
[src]
&'_ self,
topic: &'_ str,
handler: F
) -> SubscribeId where
F: FnMut(T) -> R + Send + 'static,
R: Future<Output = ()> + Send + 'static,
T: Topic,
订阅指定主题的消息
pub async fn unsubscribe(&'_ self, id: SubscribeId)
[src]
取消订阅消息
Trait Implementations
impl Context for Client
[src]
fn call<'life0, 'life1, 'async_trait, T, R>(
&'life0 self,
service_name: &'life1 str,
request: Request<T>
) -> Pin<Box<dyn Future<Output = Result<Response<R>, Error>> + 'async_trait + Send>> where
'life0: 'async_trait,
'life1: 'async_trait,
R: DeserializeOwned + Send + 'static + 'async_trait,
T: Serialize + Send + 'static + 'async_trait,
Client: 'async_trait,
[src]
&'life0 self,
service_name: &'life1 str,
request: Request<T>
) -> Pin<Box<dyn Future<Output = Result<Response<R>, Error>> + 'async_trait + Send>> where
'life0: 'async_trait,
'life1: 'async_trait,
R: DeserializeOwned + Send + 'static + 'async_trait,
T: Serialize + Send + 'static + 'async_trait,
Client: 'async_trait,
fn notify<'life0, 'life1, 'async_trait, T>(
&'life0 self,
service_name: &'life1 str,
request: Request<T>
) -> Pin<Box<dyn Future<Output = ()> + 'async_trait + Send>> where
'life0: 'async_trait,
'life1: 'async_trait,
T: 'static + Send + Serialize + 'async_trait,
Client: 'async_trait,
[src]
&'life0 self,
service_name: &'life1 str,
request: Request<T>
) -> Pin<Box<dyn Future<Output = ()> + 'async_trait + Send>> where
'life0: 'async_trait,
'life1: 'async_trait,
T: 'static + Send + Serialize + 'async_trait,
Client: 'async_trait,
fn notify_to<'life0, 'async_trait, T>(
&'life0 self,
to: ServiceId,
request: Request<T>
) -> Pin<Box<dyn Future<Output = ()> + 'async_trait + Send>> where
'life0: 'async_trait,
T: 'static + Send + Serialize + 'async_trait,
Client: 'async_trait,
[src]
&'life0 self,
to: ServiceId,
request: Request<T>
) -> Pin<Box<dyn Future<Output = ()> + 'async_trait + Send>> where
'life0: 'async_trait,
T: 'static + Send + Serialize + 'async_trait,
Client: 'async_trait,
fn publish_with_topic<'life0, 'life1, 'async_trait, T>(
&'life0 self,
topic: &'life1 str,
msg: T
) -> Pin<Box<dyn Future<Output = ()> + 'async_trait + Send>> where
'life0: 'async_trait,
'life1: 'async_trait,
T: Topic + 'async_trait,
Client: 'async_trait,
[src]
&'life0 self,
topic: &'life1 str,
msg: T
) -> Pin<Box<dyn Future<Output = ()> + 'async_trait + Send>> where
'life0: 'async_trait,
'life1: 'async_trait,
T: Topic + 'async_trait,
Client: 'async_trait,
fn publish<'life0, 'async_trait, T>(
&'life0 self,
msg: T
) -> Pin<Box<dyn Future<Output = ()> + 'async_trait + Send>> where
'life0: 'async_trait,
Self: Sync + 'async_trait,
T: Topic + 'async_trait,
[src]
&'life0 self,
msg: T
) -> Pin<Box<dyn Future<Output = ()> + 'async_trait + Send>> where
'life0: 'async_trait,
Self: Sync + 'async_trait,
T: Topic + 'async_trait,
impl Drop for Client
[src]
Auto Trait Implementations
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,