[−][src]Function twitchchat::encode
pub async fn encode<'_, '_, M: ?Sized, W: ?Sized>(
message: &'_ M,
writer: &'_ mut W
) -> Result<()> where
M: Encodable,
W: AsyncWrite + Unpin,
Encode the provided message to the tokio::io::AsyncWrite
Example
let mut writer = vec![]; let message = encode::join("#museun"); encode(&message, &mut writer).await.unwrap(); assert_eq!( std::str::from_utf8(&writer).unwrap(), "JOIN #museun\r\n" );