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
Implementation of methods for the Server structure.
impl Server
Implementation of methods for the Server structure.
Sourcepub async fn server_config(&self, config: ServerConfig) -> &Self
pub async fn server_config(&self, config: ServerConfig) -> &Self
Sourcepub fn get_bind_addr<H>(host: H, port: u16) -> String
pub fn get_bind_addr<H>(host: H, port: u16) -> String
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 read_error<H>(&self) -> &Selfwhere
H: ServerHook,
pub async fn read_error<H>(&self) -> &Selfwhere
H: ServerHook,
Sourcepub async fn run(&self) -> Result<ServerControlHook, ServerError>
pub async fn run(&self) -> Result<ServerControlHook, ServerError>
Starts the server and begins accepting connections.
§Returns
Result<ServerControlHook, ServerError>- The control hook on success, or an error on failure.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Server
impl !RefUnwindSafe for Server
impl Send for Server
impl Sync for Server
impl Unpin for Server
impl !UnwindSafe for Server
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