Skip to content

Commit

Permalink
chore: add reexports for handlers (#203)
Browse files Browse the repository at this point in the history
  • Loading branch information
elcharitas authored Sep 29, 2024
1 parent 82c412f commit 6e40dc3
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 10 deletions.
2 changes: 1 addition & 1 deletion crates/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub mod prelude {
pub use crate::macros::*;
pub use ngyn_hyper::HyperApplication;
pub use ngyn_shared::{
core::{handler, NgynEngine},
core::{handler::*, engine::NgynEngine},
server::{
Body, JsonResponse, JsonResult, NgynContext, NgynRequest, NgynResponse, Param, Query,
Transducer,
Expand Down
6 changes: 3 additions & 3 deletions crates/shared/src/core/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ use http::Request;
use http_body_util::Full;
use std::sync::Arc;

use super::RouteHandler;
use super::handler::RouteHandler;
use crate::{
server::{context::AppState, Method, NgynContext, NgynResponse},
traits::{Middleware, NgynController, NgynInterpreter, NgynMiddleware, NgynModule},
};

#[derive(Default)]
pub struct PlatformData {
routes: Vec<(String, Option<Method>, Box<crate::core::RouteHandler>)>,
routes: Vec<(String, Option<Method>, Box<RouteHandler>)>,
middlewares: Vec<Box<dyn crate::traits::Middleware>>,
interpreters: Vec<Box<dyn NgynInterpreter>>,
state: Option<Arc<Box<dyn AppState>>>,
Expand Down Expand Up @@ -243,7 +243,7 @@ pub trait NgynEngine: NgynPlatform {

#[cfg(test)]
mod tests {
use crate::{core::Handler, traits::NgynInjectable};
use crate::{core::handler::Handler, traits::NgynInjectable};
use std::any::Any;

use super::*;
Expand Down
2 changes: 1 addition & 1 deletion crates/shared/src/core/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ impl<F: Fn(&mut NgynContext, &mut NgynResponse) + Send + Sync + 'static> From<F>

impl From<AsyncHandler> for RouteHandler {
fn from(f: AsyncHandler) -> Self {
RouteHandler::Async(Box::new(f))
RouteHandler::Async(f)
}
}

Expand Down
7 changes: 2 additions & 5 deletions crates/shared/src/core/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
mod engine;
mod handler;

pub use engine::*;
pub use handler::*;
pub mod engine;
pub mod handler;

0 comments on commit 6e40dc3

Please sign in to comment.