pub struct Listener { /* private fields */ }Expand description
HTTP listener whose callback maps GET paths to (content_type, body).
The callback runs on a Tokio worker and must not block it.
Implementations§
Source§impl Listener
impl Listener
Sourcepub async fn bind<F>(address: &str, route: F) -> Result<Self>
pub async fn bind<F>(address: &str, route: F) -> Result<Self>
Bind an IP address or DNS hostname, then start accepting connections.
Sourcepub async fn bind_with_status<F>(address: &str, route: F) -> Result<Self>
pub async fn bind_with_status<F>(address: &str, route: F) -> Result<Self>
Bind an endpoint whose callback also selects the HTTP status.
Sourcepub async fn bind_with_methods<F>(address: &str, route: F) -> Result<Self>
pub async fn bind_with_methods<F>(address: &str, route: F) -> Result<Self>
Bind an endpoint that can route all HTTP methods.
pub fn local_addr(&self) -> SocketAddr
Trait Implementations§
Auto Trait Implementations§
impl Forget for Listener
impl Freeze for Listener
impl Move for Listener
impl RefUnwindSafe for Listener
impl Send for Listener
impl Sync for Listener
impl Unpin for Listener
impl UnsafeUnpin for Listener
impl UnwindSafe for Listener
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