tsukuyomi-rs / tsukuyomi

Asynchronous Web framework for Rust
https://tsukuyomi-rs.github.io/tsukuyomi
Apache License 2.0
84 stars 3 forks source link

add parameter 'preset' to the custom derive IntoResponse #209

Closed ubnt-intrepid closed 5 years ago

ubnt-intrepid commented 5 years ago

In the previous method using with = "..", that takes the path to a free function with the same signature as IntoResponse::into_response, it was impossible to properly set the associated type since the information about the specified function is unknown.

This PR introduces a new trait Preset<T> that contains information necessary for code generation, and a parameter 'preset = ".."' to the custom derive IntoResponse to specify the code generation using this trait.

codecov[bot] commented 5 years ago

Codecov Report

Merging #209 into master will increase coverage by 0.3%. The diff coverage is 86.31%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master     #209     +/-   ##
=========================================
+ Coverage   57.47%   57.77%   +0.3%     
=========================================
  Files          70       70             
  Lines        6812     6870     +58     
=========================================
+ Hits         3915     3969     +54     
- Misses       2897     2901      +4
Impacted Files Coverage Δ
tsukuyomi/macros/src/lib.rs 11.11% <ø> (ø) :arrow_up:
tsukuyomi/tests/integration_tests/macros.rs 72.28% <100%> (+16.51%) :arrow_up:
tsukuyomi/src/output.rs 47.95% <50%> (-1.52%) :arrow_down:
tsukuyomi/macros/src/derive_into_response.rs 85% <88.23%> (+1.12%) :arrow_up:
tsukuyomi-askama/tests/test_askama.rs 91.17% <0%> (+0.26%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 50afce8...7b70579. Read the comment docs.