Struct twilight_lavalink::node::Node[][src]

pub struct Node(_);

A connection to a single Lavalink server. It receives events and forwards events from players to the server.

Please refer to the module documentation.

Implementations

impl Node[src]

pub async fn connect(
    config: NodeConfig,
    players: PlayerManager
) -> Result<(Self, UnboundedReceiver<IncomingEvent>), NodeError>
[src]

Connect to a node, providing a player manager so that the node can update player details.

Please refer to the module documentation for some additional information about directly creating and using nodes. You are encouraged to use the Lavalink client instead.

pub fn config(&self) -> &NodeConfig[src]

Retrieve an immutable reference to the node’s configuration.

pub async fn players(&self) -> &PlayerManager[src]

Retrieve an immutable reference to the player manager used by the node.

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

Retrieve an immutable reference to the node’s configuration.

Note that sending player events through the node’s sender won’t update player states, such as whether it’s paused.

pub fn sender(&self) -> UnboundedSender<OutgoingEvent>[src]

Retrieve a unique sender to send events to the Lavalink server.

Note that sending player events through the node’s sender won’t update player states, such as whether it’s paused.

pub async fn stats(&self) -> Stats[src]

Retrieve a copy of the node’s stats.

pub async fn penalty(&self) -> i32[src]

Retrieve the calculated penalty score of the node.

This score can be used to calculate how loaded the server is. A higher number means it is more heavily loaded.

Trait Implementations

impl Clone for Node[src]

impl Debug for Node[src]

Auto Trait Implementations

impl !RefUnwindSafe for Node

impl Send for Node

impl Sync for Node

impl Unpin for Node

impl !UnwindSafe for Node

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> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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>,