Struct trillium_testing::RuntimelessServer
source · pub struct RuntimelessServer { /* private fields */ }
Expand description
A [Server
] for testing that does not depend on any runtime
Trait Implementations§
source§impl Debug for RuntimelessServer
impl Debug for RuntimelessServer
source§impl Drop for RuntimelessServer
impl Drop for RuntimelessServer
source§impl Server for RuntimelessServer
impl Server for RuntimelessServer
§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 [
Transport
]source§const DESCRIPTION: &'static str = "test server"
const DESCRIPTION: &'static str = "test server"
The description of this server, to be appended to the Info and potentially logged.
source§fn accept(
&mut self
) -> Pin<Box<dyn Future<Output = Result<Self::Transport>> + Send + '_>>
fn accept( &mut self ) -> Pin<Box<dyn Future<Output = Result<Self::Transport>> + Send + '_>>
Asynchronously return a single
Self::Transport
from a
Self::Listener
. Must be implemented.source§fn build_listener<A>(config: &Config<Self, A>) -> Selfwhere
A: Acceptor<Self::Transport>,
fn build_listener<A>(config: &Config<Self, A>) -> Selfwhere
A: Acceptor<Self::Transport>,
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::listener_from_tcp
] and
[Server::listener_from_unix
].source§fn info(&self) -> Info
fn info(&self) -> Info
Build an [
Info
] from the Self::Listener type. See [Info
]
for more details.source§fn block_on(fut: impl Future<Output = ()> + 'static)
fn block_on(fut: impl Future<Output = ()> + 'static)
Runtime implementation hook for blocking on a top level future.
source§fn spawn(fut: impl Future<Output = ()> + Send + 'static)
fn spawn(fut: impl Future<Output = ()> + Send + 'static)
Runtime implementation hook for spawning a task.
§fn clean_up(self) -> Pin<Box<dyn Future<Output = ()> + Send>>
fn clean_up(self) -> Pin<Box<dyn Future<Output = ()> + Send>>
After the server has shut down, perform any housekeeping, eg
unlinking a unix socket.
§fn listener_from_tcp(_tcp: TcpListener) -> Self
fn listener_from_tcp(_tcp: TcpListener) -> Self
Build a Self::Listener from a tcp listener. This is called by
the [
Server::build_listener
] default implementation, and
is mandatory if the default implementation is used.§fn listener_from_unix(_tcp: UnixListener) -> Self
fn listener_from_unix(_tcp: UnixListener) -> Self
Build a Self::Listener from a tcp listener. This is called by
the [
Server::build_listener
] default implementation. You
will want to tag an implementation of this with #[cfg(unix)].§fn handle_signals(_stopper: Stopper) -> Pin<Box<dyn Future<Output = ()> + Send>>
fn handle_signals(_stopper: Stopper) -> Pin<Box<dyn Future<Output = ()> + Send>>
Implementation hook for listening for any os signals and
stopping the provided [
Stopper
]. The returned future will be
spawned using [Server::spawn
]Auto Trait Implementations§
impl RefUnwindSafe for RuntimelessServer
impl Send for RuntimelessServer
impl Sync for RuntimelessServer
impl !Unpin 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