#[non_exhaustive]pub struct EdgeServer<F> {
pub handler: F,
pub port: u16,
}Expand description
Portable Edge server running a local Axum emulator on native, and a direct executor on WASM.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.handler: FThe edge HTTP request handler function.
port: u16Optional: Local port to bind the emulation server.
Implementations§
Source§impl<F, Fut> EdgeServer<F>where
F: Fn(EdgeRequest) -> Fut + Clone + Send + Sync + 'static,
Fut: Future<Output = EdgeResponse> + Send + 'static,
impl<F, Fut> EdgeServer<F>where
F: Fn(EdgeRequest) -> Fut + Clone + Send + Sync + 'static,
Fut: Future<Output = EdgeResponse> + Send + 'static,
Sourcepub async fn run(self) -> Result<(), Box<dyn Error>>
pub async fn run(self) -> Result<(), Box<dyn Error>>
Serves request handling either natively as an emulator or natively in WASM edge runtimes.
The native emulator binds 127.0.0.1 unless HOST or RULLST_HOST is
set (the same variables, in the same order, as crate::Server). It
answers every path including /. A request body larger than
2 MiB is rejected with 413, and a body that cannot be
read with 400, without calling the handler.
Auto Trait Implementations§
impl<F> Freeze for EdgeServer<F>where
F: Freeze,
impl<F> RefUnwindSafe for EdgeServer<F>where
F: RefUnwindSafe,
impl<F> Send for EdgeServer<F>where
F: Send,
impl<F> Sync for EdgeServer<F>where
F: Sync,
impl<F> Unpin for EdgeServer<F>where
F: Unpin,
impl<F> UnsafeUnpin for EdgeServer<F>where
F: UnsafeUnpin,
impl<F> UnwindSafe for EdgeServer<F>where
F: UnwindSafe,
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