Struct thruster::Server

source ·
pub struct Server<T: 'static + Context<Response = Response> + Clone + Send + Sync, S: 'static + Send + Sync> { /* private fields */ }

Implementations§

source§

impl<T: 'static + Context<Response = Response> + Clone + Send + Sync, S: 'static + Send + Sync> Server<T, S>

source

pub fn start_work_stealing_optimized(self, host: &str, port: u16)

Starts the app with the default tokio runtime execution model

source

pub fn start_small_load_optimized(self, host: &str, port: u16)

Starts the app with a thread pool optimized for small requests and quick timeouts. This is done internally by spawning a separate thread for each reactor core. This is valuable if all server endpoints are similar in their load, as work is divided evenly among threads. As seanmonstar points out though, this is a very specific use case and might not be useful for everyday work loads.alloc

See the discussion here for more information:

https://users.rust-lang.org/t/getting-tokio-to-match-actix-web-performance/18659/7

Trait Implementations§

source§

impl<T: Context<Response = Response> + Clone + Send + Sync, S: 'static + Send + Sync> ThrusterServer for Server<T, S>

§

type Context = T

§

type Response = Response

§

type Request = Request

§

type State = S

source§

fn new(app: App<Self::Request, T, S>) -> Self

source§

fn build(self, host: &str, port: u16) -> ReusableBoxFuture<()>

source§

fn start(self, host: &str, port: u16)where Self: Sized,

Auto Trait Implementations§

§

impl<T, S> !RefUnwindSafe for Server<T, S>

§

impl<T, S> Send for Server<T, S>

§

impl<T, S> Sync for Server<T, S>

§

impl<T, S> Unpin for Server<T, S>

§

impl<T, S> !UnwindSafe for Server<T, S>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere 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 Twhere 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.