Struct synac::state::State
[−]
[src]
pub struct State { pub channels: HashMap<usize, Channel>, pub users: HashMap<usize, User>, }
A struct that remembers stuff previous packets have informed about
Fields
channels: HashMap<usize, Channel>
users: HashMap<usize, User>
Methods
impl State
[src]
fn new() -> Self
[src]
Create new state
fn update(&mut self, packet: &Packet)
[src]
Update the state with packet
fn get_private_channel<'a>(&'a self, user: &User) -> Option<&'a Channel>
[src]
Search for a private channel with user
fn get_recipient(&self, channel: &Channel, me: usize) -> Option<&User>
[src]
Search for the recipient in a private channel
fn get_recipient_unchecked(&self, channel_id: usize, me: usize) -> Option<&User>
[src]
Search for the recipient in a private channel. If the channel isn't private, it returns the first user it can find that has a special mode in that channel. So you should probably make sure it's private first.