pub struct HttpListener { /* private fields */ }Expand description
A running HTTP server that routes all inbound requests to a handler actor
via StableAddr<HttpRequest>.
The listener runs as a Tokio background task. If the handler actor is
restarted by its supervisor, the StableAddr transparently routes to the
new incarnation — no listener reconfiguration required.
Drop or call shutdown to stop the server.
Implementations§
Source§impl HttpListener
impl HttpListener
Sourcepub async fn bind(
addr: SocketAddr,
handler: StableAddr<HttpRequest>,
config: ListenerConfig,
) -> Result<Self, HttpError>
pub async fn bind( addr: SocketAddr, handler: StableAddr<HttpRequest>, config: ListenerConfig, ) -> Result<Self, HttpError>
Bind a TCP port and begin routing requests to handler.
Preferred form: the StableAddr survives handler actor restarts.
Sourcepub async fn bind_plain(
addr: SocketAddr,
handler: Addr<HttpRequest>,
config: ListenerConfig,
) -> Result<Self, HttpError>
pub async fn bind_plain( addr: SocketAddr, handler: Addr<HttpRequest>, config: ListenerConfig, ) -> Result<Self, HttpError>
Bind using a plain palladium_actor::Addr.
Equivalent to bind(addr, StableAddr::from_addr(handler), config).
Requests will fail if the actor is restarted; prefer [bind].
Sourcepub fn local_addr(&self) -> SocketAddr
pub fn local_addr(&self) -> SocketAddr
Returns the local address the listener is bound to.
Auto Trait Implementations§
impl Freeze for HttpListener
impl !RefUnwindSafe for HttpListener
impl Send for HttpListener
impl Sync for HttpListener
impl Unpin for HttpListener
impl UnsafeUnpin for HttpListener
impl !UnwindSafe for HttpListener
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