murmur_grpc

Docs.rs badge Crates.io badge

This library was primarily created for my own purposes in order to take the pain out of interacting with Murmur's gRPC inteface. All of the functionality is available, but no extensive testing has been done at this point so your mileage may vary. The documentation is very sparse at the moment because I am very stupid, but I intend to improve it as the library matures.

Examples

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, 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(); serverdisconnectreceiver = murmurgrpc::start(1, vec![i])[0].2; // keep the main thread alive until the server connection closes serverdisconnectreceiver.recv(); } ```