twitch_message 0.1.2

A parser for Twitch.tv chat messages
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use std::io::Write;

/// A trait to encode a type onto this [`std::io::Write`]
pub trait Encode: Write {
    /// Encode the given type
    fn encode_msg(&mut self, msg: impl Encodable) -> std::io::Result<()> {
        msg.encode(self)
    }
}

impl<T> Encode for T where T: Write {}

/// A trait for encoding a message with [`std::io::Write`]
pub trait Encodable {
    /// Encode the given type
    fn encode(&self, writer: impl Write) -> std::io::Result<()>;
}