From 0c7a90e3a61c78207bd39a395b732383e37e7385 Mon Sep 17 00:00:00 2001 From: Fangdun Tsai Date: Fri, 15 Dec 2023 07:01:47 +0800 Subject: [PATCH] bump: viz-macros v0.2.0 --- viz-macros/Cargo.toml | 2 +- viz-macros/src/lib.rs | 15 ++++++++------- viz-macros/tests/handler.rs | 4 +++- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/viz-macros/Cargo.toml b/viz-macros/Cargo.toml index 060a384e..c6b87d97 100644 --- a/viz-macros/Cargo.toml +++ b/viz-macros/Cargo.toml @@ -21,7 +21,7 @@ syn = { version = "2.0", features = ["full"] } quote = "1.0" [dev-dependencies] -viz.workspace = true +viz-core.workspace = true anyhow.workspace = true tokio = { workspace = true, features = ["rt", "macros"] } diff --git a/viz-macros/src/lib.rs b/viz-macros/src/lib.rs index d23e8dbe..c2283894 100644 --- a/viz-macros/src/lib.rs +++ b/viz-macros/src/lib.rs @@ -7,7 +7,7 @@ //! ## Example //! //! ``` -//! # use viz::{IntoResponse, Result}; +//! # use viz_core::{IntoResponse, Result}; //! # use viz_macros::handler; //! //! #[handler] @@ -112,7 +112,8 @@ fn generate_handler(input: TokenStream) -> Result { .fold(Vec::new(), |mut extractors, input| { if let FnArg::Typed(pat) = input { let ty = &pat.ty; - extractors.push(quote!(<#ty as viz::FromRequest>::extract(&mut req).await?)); + extractors + .push(quote!(<#ty as viz_core::FromRequest>::extract(&mut req).await?)); } extractors }); @@ -123,16 +124,16 @@ fn generate_handler(input: TokenStream) -> Result { #[derive(Clone)] #vis struct #name; - #[viz::async_trait] - impl viz::Handler for #name + #[viz_core::async_trait] + impl viz_core::Handler for #name { - type Output = viz::Result; + type Output = viz_core::Result; #[allow(unused, unused_mut)] - async fn call(&self, mut req: viz::Request) -> Self::Output { + async fn call(&self, mut req: viz_core::Request) -> Self::Output { #ast let res = #name(#(#extractors),*)#asyncness; - #out.map(viz::IntoResponse::into_response) + #out.map(viz_core::IntoResponse::into_response) } } }; diff --git a/viz-macros/tests/handler.rs b/viz-macros/tests/handler.rs index d2d99d91..013ac8a4 100644 --- a/viz-macros/tests/handler.rs +++ b/viz-macros/tests/handler.rs @@ -1,7 +1,9 @@ #![allow(clippy::unused_async)] #![allow(clippy::unnecessary_wraps)] -use viz::{async_trait, Error, FromRequest, Handler, IntoResponse, Request, Result, StatusCode}; +use viz_core::{ + async_trait, Error, FromRequest, Handler, IntoResponse, Request, Result, StatusCode, +}; use viz_macros::handler; #[derive(Debug)]