GithubHelp home page GithubHelp logo

Comments (6)

carllerche avatar carllerche commented on July 22, 2024

If this change is done, the best way to go about it will probably be to represent NewService as a "service of services". In other words, to implement a NewService, one would implement Service such that Response: Service.

To ease usage of this trait, the main "tower" crate can have a NewService "trait alias".

Also, what do people think about renaming NewService -> MakeService and use the Make prefix for "factories" instead of New.

The main problem I have is, what does this return:

fn build_new_service() -> ....

Does it return T: Service or T: NewService?

fn build_make_service() is a bit clearer.

Thoughts @seanmonstar @olix0r?

from tower.

seanmonstar avatar seanmonstar commented on July 22, 2024

The name NewServivce does cause a little confusion. I'm fine with MakeService, I think.

from tower.

seanmonstar avatar seanmonstar commented on July 22, 2024

To change NewService to basically be a Service of services, it seems making a new service would require mutable access (calling self.call inside self.make_service).

from tower.

seanmonstar avatar seanmonstar commented on July 22, 2024

There's also Service::poll_ready, which suggests there needing to be a MakeService::poll_ready. I actually think that makes sense, and allows for a server to say it cannot handle any more connections for now...

from tower.

carllerche avatar carllerche commented on July 22, 2024

@seanmonstar yes, I think poll_ready makes sense, the question is about &mut self. However, &mut self makes sense with poll_ready.

from tower.

seanmonstar avatar seanmonstar commented on July 22, 2024

We did this in #114.

from tower.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.