pub struct Server(/* private fields */);Expand description
The primary server structure that provides a thread-safe interface to the server’s state.
This struct acts as a public-facing wrapper around an Arc<RwLock<ServerData>>.
It allows multiple parts of the application to safely share and modify the server’s
configuration and state across different threads and asynchronous tasks.
Implementations§
Source§impl Server
Represents the server, providing methods to configure and run it.
impl Server
Represents the server, providing methods to configure and run it.
This struct wraps the ServerData configuration and handler logic,
offering a high-level API for setting up the UDP server.
Sourcepub async fn server_config(&self, config: ServerConfig) -> &Self
pub async fn server_config(&self, config: ServerConfig) -> &Self
Sourcepub async fn hook<H>(&self) -> &Selfwhere
H: ServerHook,
pub async fn hook<H>(&self) -> &Selfwhere
H: ServerHook,
Sourcepub async fn task_panic<H>(&self) -> &Selfwhere
H: ServerHook,
pub async fn task_panic<H>(&self) -> &Selfwhere
H: ServerHook,
Sourcepub async fn run(&self) -> Result<ServerControlHook, ServerError>
pub async fn run(&self) -> Result<ServerControlHook, ServerError>
Starts the server, binds to the configured address, and begins listening for requests.
This is the main entry point to launch the server. It will create a UDP socket, bind to the configured address, and then enter the request acceptance loop.
§Returns
Returns a Result containing a ServerControlHook on success.
Returns an error if the server fails to start.
Trait Implementations§
Source§impl PartialEq for Server
Implements the PartialEq trait for Server.
impl PartialEq for Server
Implements the PartialEq trait for Server.
This allows for comparing two Server instances for equality.
impl Eq for Server
Implements the Eq trait for Server.
This indicates that Server has a total equality relation.