You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My feeling of the present state of things here is that closures are being used excessively, in ways that don't add value. For example, the closure-taking constructor and sort-of-setter methods feel weird. Taking the main function of the README example:
fnmain(){let app = do Application::new |app|
{
do app.settings |settings| {
settings.socket = Some(SocketAddr{ip:Ipv4Addr(127,0,0,1),port:4000})}
do app.routes |routes| {
routes.get(~"/foo/(?<id>.*)", hello_world);
routes.post(~"/", hello_post);}};let server = WidmannServer::new(app);
server.serve_forever();}
It seems to me that that would be much nicer like this:
fnmain(){let app = do Application::new();
app.settings.socket = Some(SocketAddr{ip:Ipv4Addr(127,0,0,1),port:4000});
app.routes.get(~"/foo/(?<id>.*)", hello_world);
app.routes.post(~"/", hello_post);let server = WidmannServer::new(app);
server.serve_forever();}
The text was updated successfully, but these errors were encountered:
I am not decided on that yet. In general, I'd like Application to be some glue around Routes and the settings system, so maybe I'll decide on changing that.
From an API perspective, it allows me to get call some hooks in between to set stuff up, which the user would have to call otherwise.
My feeling of the present state of things here is that closures are being used excessively, in ways that don't add value. For example, the closure-taking constructor and sort-of-setter methods feel weird. Taking the main function of the README example:
It seems to me that that would be much nicer like this:
The text was updated successfully, but these errors were encountered: