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 core::fmt::Write;

/// A trait to format a type onto this [`core::fmt::Write`]
pub trait Format: Write {
    /// Format the message
    fn format_msg(&mut self, msg: impl Formattable) -> core::fmt::Result {
        msg.format(self)
    }
}

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

/// A trait for formatting a message with [`core::fmt::Write`]
pub trait Formattable {
    /// Format the message
    fn format(&self, fmt: impl Write) -> core::fmt::Result;
}