Crates.io | juno |
lib.rs | juno |
version | 0.1.5-beta |
source | src |
created_at | 2020-04-14 03:19:14.709931 |
updated_at | 2020-06-04 13:52:01.356766 |
description | A helper rust library for the juno microservices framework |
homepage | https://github.com/bytesonus/juno-rust |
repository | https://github.com/bytesonus/juno-rust |
max_upload_size | |
id | 229865 |
size | 58,506 |
This is a library that provides you with helper methods for interfacing with the microservices framework, juno.
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.
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;
}
}