[][src]Struct potatonet::client::Client

pub struct Client { /* fields omitted */ }

客户端

Methods

impl Client[src]

pub async fn connect<A>(addr: A) -> Result<Client, Error> where
    A: ToSocketAddrs
[src]

连接到消息总线

pub fn node_id(&self) -> NodeId[src]

获取当前节点id

pub async fn register_service<N>(&'_ self, name: N, id: LocalServiceId) where
    N: Into<String>, 
[src]

注册服务

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]

订阅消息 如果重复订阅,则会按订阅顺序依次触发回调函数,并不会增加数据传输流量

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]

订阅指定主题的消息

pub async fn unsubscribe(&'_ self, id: SubscribeId)[src]

取消订阅消息

Trait Implementations

impl Context for Client[src]

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]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,