[][src]Struct twilight_lavalink::player::Player

pub struct Player { /* fields omitted */ }

A player for a guild connected to a node.

This can be used to send events over a node and to read the details of a player for a guild.

Implementations

impl Player[src]

pub fn send(
    &self,
    event: impl Into<OutgoingEvent>
) -> Result<(), TrySendError<OutgoingEvent>>
[src]

Send an event to the player's node.

Returns a futures_channel TrySendError if the node has been removed.

Examples

Send a Play and Pause event:

use twilight_lavalink::{model::{Play, Pause}, Lavalink};

let lavalink = Lavalink::new(user_id, 10);
let players = lavalink.players();

if let Some(player) = players.get(&guild_id) {
    player.send(Play::from((guild_id, track)))?;
    player.send(Pause::from((guild_id, true)))?;
}

pub fn node(&self) -> &Node[src]

Return an immutable reference to the node linked to the player.

pub fn channel_id(&self) -> Option<ChannelId>[src]

Return a copy of the player's channel ID.

pub fn guild_id(&self) -> GuildId[src]

Return an copy of the player's guild ID.

pub fn paused(&self) -> bool[src]

Return a copy of whether the player is paused.

pub fn position(&self) -> i64[src]

Return a copy of the player's position.

pub fn time_ref(&mut self) -> i64[src]

Return a copy of the player's time.

pub fn volume_ref(&self) -> u16[src]

Return a copy of the player's volume.

Trait Implementations

impl Debug for Player[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,