Skip to content

TeamTalk SDK for Rust: High-performance API and Native Bindings

Notifications You must be signed in to change notification settings

BlindMaster24/TeamTalkRust

Repository files navigation

TeamTalk SDK for Rust

Crates.io Documentation CI License

TeamTalk SDK for Rust is a high-level, safety-first wrapper for the BearWare.dk TeamTalk 5 SDK. It provides strict typing and a pure event-driven model for performance and reliability.

Key Features

  • Pure Event-Driven Architecture: Reactive model via client.poll() with no arbitrary sleeps.
  • Strict Typing: Strong IDs such as UserId and ChannelId prevent misuse.
  • Dynamic Runtime Loading: loader.rs downloads SDK binaries when needed.
  • Full API Coverage: Events, audio, video, desktop, files, and administration.
  • Documentation: API reference plus guides under docs.

Installation

Add this to your Cargo.toml:

[dependencies]
teamtalk = "1.2.0"

For the latest development version from main:

[dependencies]
teamtalk = { git = "https://github.com/BlindMaster24/TeamTalkRust.git", branch = "main" }

Quick add:

cargo add teamtalk

Dev install via cargo:

cargo add teamtalk --git https://github.com/BlindMaster24/TeamTalkRust.git --branch main

Quick Start

use teamtalk::{Client, Event};
use teamtalk::types::ChannelId;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    teamtalk::init()?;
    let client = Client::new()?;
    client.connect("127.0.0.1", 10333, 10333, false)?;

    loop {
        if let Some((event, _msg)) = client.poll(100) {
            match event {
                Event::ConnectSuccess => {
                    client.login("RustBot", "guest", "guest", "TeamTalkRust");
                }
                Event::MySelfLoggedIn => {
                    client.join_channel(ChannelId(1), "");
                }
                Event::ConnectionLost | Event::ConnectFailed => break,
                _ => {}
            }
        }
    }
    Ok(())
}

Advanced Usage

Builders

use teamtalk::types::Channel;

let my_channel = Channel::builder("Music Room")
    .topic("Only Rock 'n' Roll")
    .max_users(50)
    .build();

client.make_channel(&my_channel);

Zero-Allocation Strings

let mut buf = String::with_capacity(1024);
teamtalk::utils::strings::copy_to_string(&raw_tt_str, &mut buf);

Project Structure

Philosophy

  • Event-driven only.
  • Strongly typed IDs for safety.
  • Encapsulated FFI with explicit conversion.

Documentation

License

MIT

About

TeamTalk SDK for Rust: High-performance API and Native Bindings

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •