[][src]Function twitchchat::sync::encode

pub fn encode<M: ?Sized, W: ?Sized>(message: &M, writer: &mut W) -> Result<()> where
    M: Encodable,
    W: Write

Encode the provided message to the std::io::Write

Example

let message = encode::join("#museun");
let mut writer = vec![];
sync::encode(&message, &mut writer).unwrap();
assert_eq!(
    std::str::from_utf8(&writer).unwrap(),
    "JOIN #museun\r\n"
);