Add GITHUB ACTIONS

Signed-off-by: trivernis <trivernis@protonmail.com>
pull/2/head
trivernis 4 years ago
parent 51505e9409
commit 8ab420e797
Signed by: Trivernis
GPG Key ID: DFFFCC2C7A02DB45

@ -0,0 +1,33 @@
name: Build and Test
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Cache build data
uses: actions/cache@v2
with:
path: |
target
~/.cargo/
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose

@ -11,9 +11,10 @@ use std::pin::Pin;
#[derive(Clone)]
/// A builder for the IPC server or client.
/// ```rust
/// ```no_run
///use rmp_ipc::IPCBuilder;
///IPCBuilder::new()
///# async fn a() {
/// IPCBuilder::new()
/// .address("127.0.0.1:2020")
/// // register callback
/// .on("ping", |_ctx, _event| Box::pin(async move {
@ -22,6 +23,7 @@ use std::pin::Pin;
/// }))
/// // can also be build_client which would return an emitter for events
/// .build_server().await.unwrap();
///# }
/// ```
pub struct IPCBuilder {
handler: EventHandler,

@ -1,9 +1,11 @@
//! This project provides an ipc server and client implementation using
//! messagepack. All calls are asynchronous and event based.
//! Client Example:
//! ```rust
//! ```no_run
//! use rmp_ipc::IPCBuilder;
//! // create the client
//! # async fn a() {
//!
//! let emitter = IPCBuilder::new()
//! .address("127.0.0.1:2020")
//! // register callback
@ -14,13 +16,15 @@
//! .build_client().await.unwrap();
//!
//! // emit an initial event
//! emitter.emit("ping", ()).await?;
//! emitter.emit("ping", ()).await.unwrap();
//! # }
//! ```
//!
//! Server Example:
//! ```rust
//! ```no_run
//! use rmp_ipc::IPCBuilder;
//! // create the server
//!# async fn a() {
//! IPCBuilder::new()
//! .address("127.0.0.1:2020")
//! // register callback
@ -29,6 +33,7 @@
//! Ok(())
//! }))
//! .build_server().await.unwrap();
//! # }
//! ```
#[cfg(test)]

Loading…
Cancel
Save