Voice Event Converter (event/from.rs)

serenity-rs/serenity · voice-model/src/event/from.rs · rust · ISC
voice, infra, lang:rust, tag:event, tag:conversion

Implements From trait to convert individual voice payload structs (Identify, Ready, etc.) into a unified Event enum for the voice gateway handling layer.

// Source: https://github.com/serenity-rs/serenity | License: ISC | Copyright 2016, Serenity Contributors
// Provided via justclaw.it.com; keep this notice with the code.
use super::Event;
use crate::payload::*;

impl From<Identify> for Event {
    fn from(i: Identify) -> Self {
        Event::Identify(i)
    }
}

impl From<SelectProtocol> for Event {
    fn from(i: SelectProtocol) -> Self {
        Event::SelectProtocol(i)
    }
}

impl From<Ready> for Event {
    fn from(i: Ready) -> Self {
        Event::Ready(i)
    }
}

impl From<Heartbeat> for Event {
    fn from(i: Heartbeat) -> Self {
        Event::Heartbeat(i)
    }
}

impl From<SessionDescription> for Event {
    fn from(i: SessionDescription) -> Self {
        Event::SessionDescription(i)
    }
}

impl From<Speaking> for Event 

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key