pub struct Server { /* private fields */ }Expand description
A mockd server bound to a configuration.
Implementations§
Source§impl Server
impl Server
Sourcepub fn from_config(config: Config) -> Result<Self, ServerError>
pub fn from_config(config: Config) -> Result<Self, ServerError>
Build a server from a parsed Config.
CORS is disabled by default; use Server::with_cors to enable it.
Sourcepub fn app(&self) -> Router
pub fn app(&self) -> Router
Build the Axum application for this server.
Exposed primarily for integration tests; Server::serve is the
normal entry point.
Sourcepub fn route_count(&self) -> usize
pub fn route_count(&self) -> usize
Number of compiled routes.
Sourcepub async fn serve(&self) -> Result<(), ServerError>
pub async fn serve(&self) -> Result<(), ServerError>
Bind the configured address and serve until interrupted.
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 UnsafeUnpin 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