pub struct ServerState {
pub clients: HashMap<String, Client>,
pub groups: Vec<Group>,
pub streams: Vec<StreamInfo>,
}Expand description
Complete server state.
Fields§
§clients: HashMap<String, Client>All known clients (by ID).
groups: Vec<Group>All groups.
streams: Vec<StreamInfo>All streams.
Implementations§
Source§impl ServerState
impl ServerState
Sourcepub fn get_or_create_client(
&mut self,
id: &str,
host_name: &str,
mac: &str,
) -> &mut Client
pub fn get_or_create_client( &mut self, id: &str, host_name: &str, mac: &str, ) -> &mut Client
Get or create a client entry. Returns mutable reference.
Sourcepub fn group_for_client(
&mut self,
client_id: &str,
default_stream: &str,
) -> &mut Group
pub fn group_for_client( &mut self, client_id: &str, default_stream: &str, ) -> &mut Group
Find which group a client belongs to, or create a new group.
Sourcepub fn remove_client_from_groups(&mut self, client_id: &str)
pub fn remove_client_from_groups(&mut self, client_id: &str)
Remove a client from all groups.
Sourcepub fn move_client_to_group(&mut self, client_id: &str, group_id: &str)
pub fn move_client_to_group(&mut self, client_id: &str, group_id: &str)
Move a client to a different group.
Sourcepub fn set_group_stream(&mut self, group_id: &str, stream_id: &str)
pub fn set_group_stream(&mut self, group_id: &str, stream_id: &str)
Set a group’s stream.
Sourcepub fn to_status_json(&self) -> Value
pub fn to_status_json(&self) -> Value
Build JSON status for the full server (matches C++ Server.GetStatus).
Trait Implementations§
Source§impl Clone for ServerState
impl Clone for ServerState
Source§fn clone(&self) -> ServerState
fn clone(&self) -> ServerState
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ServerState
impl Debug for ServerState
Source§impl Default for ServerState
impl Default for ServerState
Source§fn default() -> ServerState
fn default() -> ServerState
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for ServerState
impl<'de> Deserialize<'de> for ServerState
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ServerState
impl RefUnwindSafe for ServerState
impl Send for ServerState
impl Sync for ServerState
impl Unpin for ServerState
impl UnsafeUnpin for ServerState
impl UnwindSafe for ServerState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more