librecast 1.0.1

Rust bindings for the librecast library
Documentation
// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
// Copyright (c) 2025 Gavin Henry <ghenry@sentrypeer.org>

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()
        .name("example-channel")
        .enable_raptorq()
        .enable_loopback()
        .build()?;

    // Join the channel
    channel.join()?;

    // Rate limits the channel to 100Mbps
    channel.rate_limit(104857600)?;

    // Send a message
    let data = b"Hello, Librecast!";
    channel
        .send(data)
        .expect("Failed to send data on the channel");

    // Leave the channel
    channel.leave()?;

    Ok(())
}