Struct Server

Source
pub struct Server { /* private fields */ }
Expand description

RPC服务端

Implementations§

Source§

impl Server

Source

pub fn new() -> Self

创建一个RPC服务

Source

pub fn bind(&mut self, name: &'static str, f: Callback)

绑定RPC回调函数,请使用callback!宏必要时结合clone!宏进行bind操作

Source

pub fn publisher(&self) -> Publisher

获取发布器用于发布消息

Source

pub async fn run_by_unix( self, path: &str, on_subcribe: impl FnMut(&str) -> Option<Bytes> + Send + Sync + 'static, ) -> Result<()>

通过unix域套接字异步运行服务端监听指定的路径

Source

pub async fn run_by_tcp( self, addr: &str, on_subcribe: impl FnMut(&str) -> Option<Bytes> + Send + Sync + 'static, ) -> Result<()>

通过tcp套接字异步运行服务端监听指定的地址

Source

pub async fn run(self, addr: &str) -> Result<()>

异步运行服务端监听指定的地址,如果是类unix系统则使用unix域套接字通信,如果是其他系统则使用tcp通信

Source

pub async fn run_with( self, addr: &str, on_subcribe: impl FnMut(&str) -> Option<Bytes> + Send + Sync + 'static, ) -> Result<()>

Auto Trait Implementations§

§

impl Freeze for Server

§

impl !RefUnwindSafe for Server

§

impl Send for Server

§

impl Sync for Server

§

impl Unpin for Server

§

impl !UnwindSafe for Server

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.