juno

Crates.iojuno
lib.rsjuno
version0.1.5-beta
sourcesrc
created_at2020-04-14 03:19:14.709931
updated_at2020-06-04 13:52:01.356766
descriptionA helper rust library for the juno microservices framework
homepagehttps://github.com/bytesonus/juno-rust
repositoryhttps://github.com/bytesonus/juno-rust
max_upload_size
id229865
size58,506
Rakshith Ravi (rakshith-ravi)

documentation

README

Juno Rust

This is a library that provides you with helper methods for interfacing with the microservices framework, juno.

How to use:

There is a lot of flexibility provided by the library, in terms of connection options and encoding protocol options. However, in order to use the library, none of that is required.

In case you are planning to implement a custom connection option, you will find an example in src/connection/unix_socket_connection.rs.

For all other basic needs, you can get away without worrying about any of that.

A piece of code is worth a thousand words

use async_std::task;
use juno::{models::Value, JunoModule};
use std::{time::Duration, collections::HashMap};

#[async_std::main]
async fn main() {
    let mut module = JunoModule::default("./path/to/juno.sock");
    // The hashmap below is used to mark dependencies
    module
        .initialize("module-name", "1.0.0", HashMap::new())
        .await
        .unwrap();
    println!("Initialized!");
    module
        .declare_function("print_hello", |args| {
            println!("Hello");
            Value::Null
        })
        .await
        .unwrap();
    // The HashMap::new() below marks the arguments passed to the function
    module
        .call_function("module2.print_hello_world", HashMap::new())
        .await
        .unwrap();
    loop {
        task::sleep(Duration::from_millis(1000)).await;
    }
}
Commit count: 121

cargo fmt