[][src]Function twitchchat::register_easy

pub async fn register_easy<'_, '_, '_, W: ?Sized>(
    name: &'_ str,
    token: &'_ str,
    writer: &'_ mut W
) -> Result<()> where
    W: AsyncWrite + Unpin + Send

Write the provided name and token to the async writer

This enables all of the Capabilities

Example

let mut writer = vec![]; // or any type that impls AsyncWrite
register_easy("museun", "oauth:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", &mut writer).await?;

let lines = std::str::from_utf8(&writer)?.split_terminator("\r\n").collect::<Vec<_>>();
assert_eq!(
    lines,
    vec![
        "CAP REQ :twitch.tv/membership",
        "CAP REQ :twitch.tv/tags",
        "CAP REQ :twitch.tv/commands",
        "PASS oauth:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
        "NICK museun",
    ],
);