pub struct HyperServer { /* private fields */ }
Expand description
Hyper server struct for managing the Axum-based web server
Implementations§
Source§impl HyperServer
impl HyperServer
Sourcepub fn state(&self) -> Arc<AppState>
pub fn state(&self) -> Arc<AppState>
Returns a shared reference to the application state
§Returns
Arc<AppState>
- Shared application state
Sourcepub fn with_route(self, path: &'static str, route: MethodRouter) -> Self
pub fn with_route(self, path: &'static str, route: MethodRouter) -> Self
Sourcepub async fn server_info(
&self,
addr: Option<SocketAddr>,
) -> TransportServerResult<String>
pub async fn server_info( &self, addr: Option<SocketAddr>, ) -> TransportServerResult<String>
Sourcepub fn server_handle(&self) -> Handle
pub fn server_handle(&self) -> Handle
Returns server handle that could be used for graceful shutdown
Sourcepub async fn start(self) -> TransportServerResult<()>
pub async fn start(self) -> TransportServerResult<()>
Starts the server, choosing SSL or HTTP based on configuration
Resolves the server address and starts the server in either SSL or HTTP mode. Panics if SSL is requested but the “ssl” feature is not enabled.
§Returns
TransportServerResult<()>
- Ok if the server starts successfully, Err otherwise
Auto Trait Implementations§
impl Freeze for HyperServer
impl !RefUnwindSafe for HyperServer
impl Send for HyperServer
impl Sync for HyperServer
impl Unpin for HyperServer
impl !UnwindSafe for HyperServer
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