Struct rmp_ipc::IPCBuilder [−][src]
pub struct IPCBuilder { /* fields omitted */ }
A builder for the IPC server or client.
use rmp_ipc::IPCBuilder; IPCBuilder::new() .address("127.0.0.1:2020") // register callback .on("ping", |_ctx, _event| Box::pin(async move { println!("Received ping event."); Ok(()) })) // can also be build_client which would return an emitter for events .build_server().await.unwrap();
Implementations
impl IPCBuilder
[src]
impl IPCBuilder
[src]pub fn new() -> Self
[src]
pub fn on<F: 'static>(self, event: &str, callback: F) -> Self where
F: for<'a> Fn(&'a Context, Event) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'a>> + Send + Sync,
[src]
pub fn on<F: 'static>(self, event: &str, callback: F) -> Self where
F: for<'a> Fn(&'a Context, Event) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'a>> + Send + Sync,
[src]Adds an event callback
pub async fn build_server(self) -> Result<()>
[src]
pub async fn build_server(self) -> Result<()>
[src]Builds an ipc server
pub async fn build_client(self) -> Result<StreamEmitter>
[src]
pub async fn build_client(self) -> Result<StreamEmitter>
[src]Builds an ipc client
Trait Implementations
impl Clone for IPCBuilder
[src]
impl Clone for IPCBuilder
[src]fn clone(&self) -> IPCBuilder
[src]
fn clone(&self) -> IPCBuilder
[src]Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]Performs copy-assignment from source
. Read more
Auto Trait Implementations
impl !RefUnwindSafe for IPCBuilder
impl Send for IPCBuilder
impl Sync for IPCBuilder
impl Unpin for IPCBuilder
impl !UnwindSafe for IPCBuilder
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more