pub struct Server { /* private fields */ }
Expand description
RPC服务端
Implementations§
Source§impl Server
impl Server
Sourcepub fn bind(&mut self, name: &'static str, f: Callback)
pub fn bind(&mut self, name: &'static str, f: Callback)
绑定RPC回调函数,请使用callback!宏必要时结合clone!宏进行bind操作
Sourcepub async fn run_by_unix(
self,
path: &str,
on_subcribe: impl FnMut(&str) -> Option<Bytes> + Send + Sync + 'static,
) -> Result<()>
pub async fn run_by_unix( self, path: &str, on_subcribe: impl FnMut(&str) -> Option<Bytes> + Send + Sync + 'static, ) -> Result<()>
通过unix域套接字异步运行服务端监听指定的路径
Sourcepub async fn run_by_tcp(
self,
addr: &str,
on_subcribe: impl FnMut(&str) -> Option<Bytes> + Send + Sync + 'static,
) -> Result<()>
pub async fn run_by_tcp( self, addr: &str, on_subcribe: impl FnMut(&str) -> Option<Bytes> + Send + Sync + 'static, ) -> Result<()>
通过tcp套接字异步运行服务端监听指定的地址
Sourcepub async fn run(self, addr: &str) -> Result<()>
pub async fn run(self, addr: &str) -> Result<()>
异步运行服务端监听指定的地址,如果是类unix系统则使用unix域套接字通信,如果是其他系统则使用tcp通信
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more