# Rust bindings to the librecast C library via `librecast-sys`
[](https://masterminds.github.io/stability/active.html)
[](https://crates.io/crates/librecast)
[](https://docs.rs/librecast)
## Usage
To use `librecast`, run `cargo add librecast` like normal, then use it like so:
```rust
use librecast::Librecast;
fn main() -> Result<(), Box<dyn std::error::Error>> {
// Create a new librecast context
let librecast = Librecast::new()?;
// Create a channel using the builder pattern
let channel = librecast.channel_builder()
.channel_builder()
.name("test_channel")
//.enable_rapterq()
.build()?;
// Join the channel
channel.join()?;
// Send a message
let message = b"Hello, world!";
channel.send(message)?;
// Leave the channel
channel.leave()?;
Ok(())
}
```
## Examples
Run this first to start a receiver that listens for messages:
```bash
cargo run --example receiver
```
Then run this to send messages to the receiver, in a separate terminal:
```bash
cargo run --example sender
```
## License
This project is licensed under the [GPL-2.0-only](https://spdx.org/licenses/GPL-2.0-only.html) or
[GPL-3.0-only](https://spdx.org/licenses/GPL-3.0-only.html) license, at your option.