twitch_message
Read the docs for more detailed information
This is a crate to parse chat messages from https://www.twitch.tv
This crate does not provide any I/O rather just parsing of a &str
into typed messages.
A quick walkthrough:
use *;
// get some data from somewhere
let data: &str = read_line;
// parse returns a `ParseResult` which contains the remaining data (if any) and the parsed message
let result = parse?;
let msg: = result.message;
match msg.kind
Encoding
Format/Formattable
// this adds the # to the channel, if its missing
let pm = privmsg;
// using `Formattable`
use Formattable;
let mut buf = String new;
pm.format?;
assert_eq!;
// using `Format`
use Format;
let mut buf = String new;
buf.format_msg?;
assert_eq!;
Encode/Encodable
// this adds the # to the channel, if its missing
let pm = privmsg;
// using `Encodable`
use Encodable;
let mut buf = Vec new;
pm.encode?;
assert_eq!;
// using `Encode`
use Encode;
let mut buf = Vec new;
buf.encode_msg?;
assert_eq!;
Features
Feature | Description |
---|---|
default | there are no default features |
ping | enables the [PingTracker ] |
std | enables the Encode and Encodable traits |
serde | enables [serde ] derives on the types |
hashbrown | enables using [hashbrown ] for the internal HashMap |
sync | enables using [std::sync::Mutex ] over [std::cell::RefCell ] see sharing data |
parking_lot | same as sync except uses a [parking_lot::Mutex ] |
Twitch chat reference: link
License: 0BSD