murmur_grpc

Docs.rs badge Crates.io badge

I made this library primarily for myself in order to simplify working with gRPC. All of the functionality is available, but no extensive testing has been done at this point so your mileage may vary. I really don't reccommend using this in anything serious at this point in time.

Example Usage

This example prints the contents of every message that is sent to a Mumble server. The text_message function gets called for each message that is sent. Internally, the library is asynchronous, but to get around that a helper function named future_from_bool is provided which is demonstrated in the example below.

```rust use murmur_grpc::*;

fn textmessage(t: DataMutex<()>, c: Client, event: &Event) -> FutureBool { println!("{}", event.message.asref().unwrap().text.asref().unwrap()); // All of client's methods for communicating with Murmur are asynchronous so this function // must return a future even though we aren't doing anything asynchronous in this example. futurefrom_bool(true) }

fn main() { let i = MurmurInterfaceBuilder::new((), "http://127.0.0.1:50051") .usertextmessage(vec![textmessage]) .build(); // Connection runs in child thread murmurgrpc::start_connection(i) .join() .expect("Waiting for connection to Mumble server to close."); } ```