Struct dasi::State [] [src]

pub struct State {
    // some fields omitted
}

Known state composed from received events.

Methods

impl State

fn new(ready: ReadyEvent) -> State

Create a new state from an initial ReadyEvent.

fn unknown_members(&self) -> u64

Count the total number of server members not yet downloaded.

fn download_all_members(&mut self, connection: &Connection)

Requests a download of all member information for large servers.

The members lists are cleared on call, and then refilled as chunks are received. When unknown_members() returns 0, the download has completed.

fn update(&mut self, event: &Event)

Update the state according to the changes described in the given event.

fn user(&self) -> &CurrentUser

Get information about the logged-in user.

fn settings(&self) -> Option<&UserSettings>

Get the logged-in user's client settings. Will return None for bots.

fn server_settings(&self) -> Option<&[UserServerSettings]>

Get the logged-in user's per-server notification settings. Will return None for bots.

fn session_id(&self) -> &str

Get the websocket session ID.

fn private_channels(&self) -> &[PrivateChannel]

Get the list of private channels with other users.

fn servers(&self) -> &[LiveServer]

Get the list of servers this user has access to.

fn find_channel(&self, id: &ChannelId) -> Option<ChannelRef>

Look up a private or public channel by its ID.

fn find_voice_user(&self, user_id: UserId) -> Option<(ServerId, ChannelId)>

Look up the voice channel a user is in, if any.

For bot users which may be in multiple voice channels, the first found is returned.

Trait Implementations

Derived Implementations

impl Clone for State

fn clone(&self) -> State

1.0.0fn clone_from(&mut self, source: &Self)

impl Debug for State

fn fmt(&self, __arg_0: &mut Formatter) -> Result