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

source§

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

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

impl Drop for RuntimelessServer

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl Server for RuntimelessServer

§

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"

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 + '_>>

Asynchronously return a single Self::Transport from a Self::Listener. Must be implemented.
source§

fn build_listener<A>(config: &Config<Self, A>) -> Self
where 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
source§

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)

Runtime implementation hook for blocking on a top level future.
source§

fn spawn(fut: impl Future<Output = ()> + Send + 'static)

Runtime implementation hook for spawning a task.
source§

fn clean_up(self) -> Pin<Box<dyn Future<Output = ()> + Send>>

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

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.
source§

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
source§

fn run<A, H>(config: Config<Self, A>, handler: H)
where A: Acceptor<Self::Transport>, H: Handler,

Run a trillium application from a sync context
source§

fn run_async<A, H>( config: Config<Self, A>, handler: H ) -> Pin<Box<dyn Future<Output = ()> + Send>>
where A: Acceptor<Self::Transport>, H: Handler,

Run a trillium application from an async context. The default implementation of this method contains the core logic of this Trait.

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> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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>,

§

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>,

§

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.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more