Skip to main content

RuntimelessServer

Struct RuntimelessServer 

Source
pub struct RuntimelessServer { /* private fields */ }
Expand description

A Server for testing that does not depend on any runtime

Implementations§

Source§

impl RuntimelessServer

Source

pub fn is_empty() -> bool

returns whether there are any currently registered servers

Source

pub fn len() -> usize

returns the number of currently registered servers

Trait Implementations§

Source§

impl Debug for RuntimelessServer

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Server for RuntimelessServer

Source§

type Runtime = RuntimelessRuntime

The RuntimeTrait for this Server.
Source§

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§

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§

fn runtime() -> Self::Runtime

Return this Server’s Runtime
Source§

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

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)

After the server has shut down, perform any housekeeping, eg unlinking a unix socket.
Source§

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

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

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

Implementation hook for listening for any os signals and stopping the provided Swansong. The returned future will be spawned using RuntimeTrait::spawn

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.