diff --git a/roa-juniper/src/lib.rs b/roa-juniper/src/lib.rs index f9b4e0a..14f9c53 100644 --- a/roa-juniper/src/lib.rs +++ b/roa-juniper/src/lib.rs @@ -20,11 +20,13 @@ impl juniper::Context for JuniperContext {} impl Deref for JuniperContext { type Target = SyncContext; + #[inline] fn deref(&self) -> &Self::Target { &self.0 } } impl DerefMut for JuniperContext { + #[inline] fn deref_mut(&mut self) -> &mut Self::Target { &mut self.0 } @@ -54,6 +56,7 @@ where QueryT::TypeInfo: Send + Sync, MutationT::TypeInfo: Send + Sync, { + #[inline] async fn handle(self: Arc, mut ctx: Context, _next: Next) -> Result { let request: GraphQLRequest = ctx.read_json().await?; let juniper_ctx = JuniperContext(ctx.clone()); diff --git a/roa-multipart/src/lib.rs b/roa-multipart/src/lib.rs index 56933d7..afdc5da 100644 --- a/roa-multipart/src/lib.rs +++ b/roa-multipart/src/lib.rs @@ -77,6 +77,7 @@ struct WrapStream(Option); impl Multipart { /// Construct multipart from Context. + #[inline] pub fn new(ctx: &mut Context) -> Self { let mut map = HeaderMap::new(); if let Some(value) = ctx.req().headers.get(CONTENT_TYPE) { @@ -166,18 +167,21 @@ impl Stream for Field { impl Deref for Field { type Target = ActixField; + #[inline] fn deref(&self) -> &Self::Target { &self.0 } } impl From for Error { + #[inline] fn from(err: WrapError) -> Self { Error::new(StatusCode::BAD_REQUEST, err, true) } } impl Display for WrapError { + #[inline] fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { f.write_fmt(format_args!("{}\nmultipart form read error.", self.0)) } diff --git a/roa-router/src/lib.rs b/roa-router/src/lib.rs index 42730ab..73c8507 100644 --- a/roa-router/src/lib.rs +++ b/roa-router/src/lib.rs @@ -420,6 +420,7 @@ impl RouteTable { } /// Handle request. + #[inline] async fn end(&self, mut ctx: Context) -> Result { let uri = ctx.uri(); // standardize path @@ -460,6 +461,7 @@ impl RouteTable { #[async_trait(?Send)] impl Middleware for RouteEndpoint { + #[inline] async fn handle(self: Arc, ctx: Context, _next: Next) -> Result { match self.0.get(&ctx.method()) { None => throw!( @@ -472,6 +474,7 @@ impl Middleware for RouteEndpoint { } impl RouterParam for Context { + #[inline] fn must_param<'a>(&self, name: &'a str) -> Result> { self.param(name).ok_or_else(|| { Error::new( @@ -481,6 +484,7 @@ impl RouterParam for Context { ) }) } + #[inline] fn param<'a>(&self, name: &'a str) -> Option> { self.load_scoped::(name) }