Skip to content

Commit 4a62c37

Browse files
committed
Added basic readme and travis config file
1 parent 8c6aa4b commit 4a62c37

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed

.travis.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
language: rust
2+
rust:
3+
- stable
4+
- beta
5+
- nightly
6+
7+
jobs:
8+
allow_failures:
9+
- rust: nightly
10+
cache: cargo

README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Gotham Rust
2+
3+
This is a library that provides you with helper methods for interfacing with the microservices framework, [gotham](https://github.com/bytesonus/gotham).
4+
5+
## How to use:
6+
7+
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.
8+
9+
In case you are planning to implement a custom connection option, you will find an example in `src/connection/unix_socket_connection.rs`.
10+
11+
For all other basic needs, you can get away without worrying about any of that.
12+
13+
### A piece of code is worth a thousand words
14+
15+
```rust
16+
use async_std::task;
17+
use gotham::{models::Value, GothamModule};
18+
use std::{time::Duration, collections::HashMap};
19+
20+
async fn main() {
21+
let mut module = GothamModule::default(String::from("../path/to/gotham.sock"));
22+
module
23+
.initialize("module-name".to_string(), "1.0.0".to_string(), HashMap::new())
24+
.await
25+
.unwrap();
26+
// The hashmap is used to mark dependencies
27+
println!("Initialized!");
28+
module
29+
.declare_function("print_hello".to_string(), |args| {
30+
println!("Hello");
31+
Value::Null
32+
})
33+
.await
34+
.unwrap();
35+
module
36+
.call_function("module2.print_hello_world".to_string(), HashMap::new())
37+
.await
38+
.unwrap();
39+
// The HashMap::new() here marks the arguments passed to the function
40+
loop {
41+
task::sleep(Duration::from_millis(1000)).await;
42+
}
43+
}
44+
```

0 commit comments

Comments
 (0)