librecast 1.0.1

Rust bindings for the librecast library
Documentation

Rust bindings to the librecast C library via librecast-sys

Stability: Active Crates.io Docs.rs

Usage

To use librecast, run cargo add librecast like normal, then use it like so:

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:

cargo run --example receiver

Then run this to send messages to the receiver, in a separate terminal:

cargo run --example sender

License

This project is licensed under the GPL-2.0-only or GPL-3.0-only license, at your option.