Struct ngyn_hyper::HyperApplication

source ·
pub struct HyperApplication { /* private fields */ }
Expand description

Represents a Hyper-based application.

Implementations§

source§

impl HyperApplication

source

pub async fn listen<A: ToSocketAddrs>( self, address: A, ) -> Result<(), Box<dyn Error + Send + Sync>>

Listens for incoming connections and serves the application.

§Arguments
  • address - The address to listen on.
§Returns

A Result indicating success or failure.

Trait Implementations§

source§

impl Default for HyperApplication

source§

fn default() -> HyperApplication

Returns the “default value” for a type. Read more
source§

impl NgynPlatform for HyperApplication

source§

fn data_mut(&mut self) -> &mut PlatformData

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> NgynEngine for T
where T: NgynPlatform,

source§

fn route( &mut self, path: &str, method: Method, handler: Box<dyn Fn(&mut NgynContext, &mut Response<Full<Bytes>>) + Sync + Send>, )

Adds a route to the application. Read more
source§

fn any(&mut self, path: &str, handler: impl RouteHandle)

source§

fn get(&mut self, path: &str, handler: impl RouteHandle)

Adds a new route to the NgynApplication with the Method::Get.
source§

fn post(&mut self, path: &str, handler: impl RouteHandle)

Adds a new route to the NgynApplication with the Method::Post.
source§

fn put(&mut self, path: &str, handler: impl RouteHandle)

Adds a new route to the NgynApplication with the Method::Put.
source§

fn delete(&mut self, path: &str, handler: impl RouteHandle)

Adds a new route to the NgynApplication with the Method::Delete.
source§

fn patch(&mut self, path: &str, handler: impl RouteHandle)

Adds a new route to the NgynApplication with the Method::Patch.
source§

fn head(&mut self, path: &str, handler: impl RouteHandle)

Adds a new route to the NgynApplication with the Method::Head.
source§

fn use_middleware(&mut self, middleware: impl NgynMiddleware + 'static)

Adds a middleware to the application. Read more
source§

fn use_interpreter(&mut self, interpreter: impl NgynInterpreter + 'static)

Adds an interpreter to the application. Read more
source§

fn set_state(&mut self, state: impl AppState + 'static)

Sets the state of the application to any value that implements AppState. Read more
source§

fn load_module(&mut self, module: impl NgynModule + 'static)

Loads a component which implements NgynModule into the application. Read more
source§

fn load_controller(&mut self, controller: Arc<Box<dyn NgynController>>)

Loads a component which implements NgynController into the application. Read more
source§

fn build<AppModule>() -> Self
where AppModule: NgynModule + 'static,

Builds the application with the specified module.
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.
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