pub struct ServerList { /* private fields */ }Expand description
A list of tcp and websocket servers to use for connecting
Implementations§
Source§impl ServerList
impl ServerList
Sourcepub fn new(
tcp_servers: Vec<SocketAddr>,
ws_servers: Vec<String>,
) -> Result<Self, ServerDiscoveryError>
pub fn new( tcp_servers: Vec<SocketAddr>, ws_servers: Vec<String>, ) -> Result<Self, ServerDiscoveryError>
Create a server list from the provided servers
Sourcepub async fn discover() -> Result<ServerList, ServerDiscoveryError>
pub async fn discover() -> Result<ServerList, ServerDiscoveryError>
Discover the server list from the steam web-api with default options
Sourcepub async fn discover_with(
options: DiscoverOptions,
) -> Result<ServerList, ServerDiscoveryError>
pub async fn discover_with( options: DiscoverOptions, ) -> Result<ServerList, ServerDiscoveryError>
Discover the server list from the steam web-api with custom options
Sourcepub fn pick(&self) -> SocketAddr
pub fn pick(&self) -> SocketAddr
Pick a server from the server list, rotating them in a round-robin way for reconnects.
§Returns
The selected SocketAddr
Sourcepub fn pick_ws(&self) -> String
pub fn pick_ws(&self) -> String
Pick a WebSocket server from the server list, rotating them in a round-robin way for reconnects.
§Returns
A WebSocket URL to connect to, if the server list contains any servers.
pub fn tcp_servers(&self) -> Vec<SocketAddr>
pub fn ws_servers(&self) -> Vec<String>
Trait Implementations§
Source§impl Clone for ServerList
impl Clone for ServerList
Source§fn clone(&self) -> ServerList
fn clone(&self) -> ServerList
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 moreAuto Trait Implementations§
impl Freeze for ServerList
impl RefUnwindSafe for ServerList
impl Send for ServerList
impl Sync for ServerList
impl Unpin for ServerList
impl UnwindSafe for ServerList
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