Skip to main content

TestServerBuilder

Struct TestServerBuilder 

Source
pub struct TestServerBuilder<Cfg, F, Sf, I> { /* private fields */ }
Expand description

Builder for a single-worker test server.

The server listens on an ephemeral 127.0.0.1 port and runs in a separate thread with its own runtime.

Implementations§

Source§

impl<F, S, I> TestServerBuilder<NoConfig, F, S, I>
where F: AsyncFn() -> I + Send + Clone + 'static, I: IntoService<S, (), Io> + 'static, S: Service<(), Io> + 'static,

Source

pub fn new(factory: F) -> TestServerBuilder<NoConfig, F, S, I>

Creates a test server builder for the specified service factory.

Source§

impl<Cfg, F, S, I> TestServerBuilder<Cfg, F, S, I>
where F: AsyncFn() -> I + Send + Clone + 'static, I: IntoService<S, <Cfg as ServerAppConfig>::State, Io> + 'static, S: Service<<Cfg as ServerAppConfig>::State, Io> + 'static, Cfg: ServerAppConfig + 'static,

Source

pub fn with(cfg: Cfg, factory: F) -> TestServerBuilder<Cfg, F, S, I>

Creates a test server builder with application configuration.

Source

pub fn config<T>(self, cfg: T) -> TestServerBuilder<Cfg, F, S, I>
where T: Into<SharedCfg>,

Sets the I/O configuration for accepted server connections.

Source

pub fn client_config<T>(self, cfg: T) -> TestServerBuilder<Cfg, F, S, I>
where T: Into<SharedCfg>,

Sets the I/O configuration used by TestServer::connect.

Source

pub fn start(self) -> TestServer

Starts the test server and returns its controller.

Trait Implementations§

Source§

impl<Cfg, F, Sf, I> Debug for TestServerBuilder<Cfg, F, Sf, I>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<Cfg, F, Sf, I> !RefUnwindSafe for TestServerBuilder<Cfg, F, Sf, I>

§

impl<Cfg, F, Sf, I> !UnwindSafe for TestServerBuilder<Cfg, F, Sf, I>

§

impl<Cfg, F, Sf, I> Freeze for TestServerBuilder<Cfg, F, Sf, I>
where Cfg: Freeze, F: Freeze,

§

impl<Cfg, F, Sf, I> Send for TestServerBuilder<Cfg, F, Sf, I>
where Cfg: Send, F: Send, Sf: Send, I: Send,

§

impl<Cfg, F, Sf, I> Sync for TestServerBuilder<Cfg, F, Sf, I>
where Cfg: Sync, F: Sync, Sf: Sync, I: Sync,

§

impl<Cfg, F, Sf, I> Unpin for TestServerBuilder<Cfg, F, Sf, I>
where Cfg: Unpin, F: Unpin, Sf: Unpin, I: Unpin,

§

impl<Cfg, F, Sf, I> UnsafeUnpin for TestServerBuilder<Cfg, F, Sf, I>
where Cfg: UnsafeUnpin, F: UnsafeUnpin,

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.