pub struct RuntimelessServer { /* private fields */ }Expand description
A Server for testing that does not depend on any runtime
Implementations§
Trait Implementations§
Source§impl Debug for RuntimelessServer
impl Debug for RuntimelessServer
Source§impl Server for RuntimelessServer
impl Server for RuntimelessServer
Source§type Runtime = RuntimelessRuntime
type Runtime = RuntimelessRuntime
The
RuntimeTrait for this Server.Source§type Transport = TestTransport
type Transport = TestTransport
the individual byte stream that http
will be communicated over. This is often an async “stream”
like TcpStream or UnixStream. See
TransportSource§type UdpTransport = ()
type UdpTransport = ()
The async UDP socket type for this server. Used by QUIC adapters
for HTTP/3 support. Runtimes that do not support UDP should set
this to
().Source§async fn accept(&mut self) -> Result<Self::Transport>
async fn accept(&mut self) -> Result<Self::Transport>
Asynchronously return a single
Self::Transport from a
Self::Listener. Must be implemented.Source§fn from_host_and_port(host: &str, port: u16) -> Self
fn from_host_and_port(host: &str, port: u16) -> Self
Build a listener from the config. The default logic for this
is described elsewhere. To override the default logic, server
implementations could potentially implement this directly. To
use this default logic, implement
Server::from_tcp and
Server::from_unix.Source§async fn clean_up(self)
async fn clean_up(self)
After the server has shut down, perform any housekeeping, eg
unlinking a unix socket.
Source§fn init(&self, info: &mut Info)
fn init(&self, info: &mut Info)
Populate
Info with data from this server, such as the bound socket address.
Called during server startup before any connections are accepted.Source§fn from_tcp(tcp_listener: TcpListener) -> Self
fn from_tcp(tcp_listener: TcpListener) -> Self
Build a Self::Listener from a tcp listener. This is called by
the
Server::from_host_and_port default implementation, and
is mandatory if the default implementation is used.Source§fn from_unix(unix_listener: UnixListener) -> Self
fn from_unix(unix_listener: UnixListener) -> Self
Available on Unix only.
Build a
Self from a unix listener. This is called by
the Server::from_host_and_port default implementation. You
will want to tag an implementation of this with #[cfg(unix)].Source§fn handle_signals(_swansong: Swansong) -> impl Future<Output = ()> + Send
fn handle_signals(_swansong: Swansong) -> impl Future<Output = ()> + Send
Implementation hook for listening for any os signals and
stopping the provided
Swansong. The returned future will be
spawned using RuntimeTrait::spawnAuto Trait Implementations§
impl Freeze for RuntimelessServer
impl RefUnwindSafe for RuntimelessServer
impl Send for RuntimelessServer
impl Sync for RuntimelessServer
impl !Unpin for RuntimelessServer
impl !UnsafeUnpin for RuntimelessServer
impl UnwindSafe for RuntimelessServer
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