Combine use of Layer and ServiceBuilder #3457
              
                Unanswered
              
          
                  
                    
                      shovelmn12
                    
                  
                
                  asked this question in
                Q&A
              
            Replies: 1 comment 9 replies
-
| Try  | 
Beta Was this translation helpful? Give feedback.
                  
                    9 replies
                  
                
            
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
Hello
I would like to know if it's possible to combine use of Layer + Servicebuilder to simplify my middleware.
The API I would like to provide to my Devs:
And
SystemLayeris basically just a composition of different layers but abstracted away from the developers eyes.The issue is, as always with rust, what type
Layer::Serviceshould be?I tried
BoxServiceand to use.boxed()orBoxService::new(builder)but if gives an error (unsetisfied constraints)I like this approach as we can delegate
SystemLayerto a team ...P.S. as you probably understand I am still learning rust. The typing system is so confusing to me as I am used to the more conventional interface type but it's impossible in rust to my understanding.... I would expect to have some generic
Servicetype with genericRequest, Response, Errorand the rest is taken care for ...Would love your help !!
axum version
0.8.4
Beta Was this translation helpful? Give feedback.
All reactions