Commit Graph

1288 Commits

Author SHA1 Message Date
Sergio Benitez
6e3d23b5f0 Add that badge in. 2016-04-04 19:04:46 -07:00
Sergio Benitez
0041724aa4 Slightly cleaner form exmaple. 2016-04-04 19:02:51 -07:00
Sergio Benitez
2dbcfa10e3 Implemented FromFormValue for all of the FromStrs. 2016-04-04 04:19:07 -07:00
Sergio Benitez
d0dd49f98d Implemented FromForm derivation. Woo! 2016-04-04 04:14:18 -07:00
Sergio Benitez
b76dc137d3 Forgot to add the form file. Whoops. 2016-04-03 22:56:36 -07:00
Sergio Benitez
b7d22d58f7 Actually useful forms! 2016-04-03 22:41:31 -07:00
Sergio Benitez
3e449d2fb9 Forms are now working! 2016-04-03 21:53:25 -07:00
Sergio Benitez
ba6caad7c8 A better README. 2016-04-03 04:28:09 -07:00
Sergio Benitez
293159904f Fixed codegen to work with new API. 2016-04-03 04:25:37 -07:00
Sergio Benitez
3dfa049a1a HRTB for the win! Manual routes example fully working. 2016-04-03 03:36:30 -07:00
Sergio Benitez
72329a7145 Adding/removing TODOs. 2016-04-02 01:51:22 -07:00
Sergio Benitez
416a18abf8 Added ranked routing. 2016-04-02 01:46:41 -07:00
Sergio Benitez
69a19ccc7f Trying to clean up that ugly function... 2016-04-02 00:58:06 -07:00
Sergio Benitez
5fb12485e8 Major refactoring. Merged two Route structure. Created URI and URIBuf. 2016-04-02 00:51:40 -07:00
Sergio Benitez
50bc0d6999 Major refactoring.
Here's the idea: under the `Rocket` namespace should live things critical to
writing simple Rocket apps: Request, Response, Error, etc. Nothing should be
nested more than one level deep. Only items required for more complex things
(implementing uncommon traits, etc.) should be nested one level deep.

This commit is the first attempt at realizing this.
2016-04-01 16:54:53 -07:00
Sergio Benitez
6ba67ae79a Accidentally broke optional_result example. Now fixed. 2016-03-30 14:04:00 -07:00
Sergio Benitez
d477c18062 Major progress towards form support. 2016-03-30 01:02:21 -07:00
Sergio Benitez
fb8fdc3bc2 Cleaned up response -> split into files. Started form example.
There's something going on with Hyper. When a 303 (see other) response is sent
in response to a POST, the browser does a GET to the location header. Hyper
somehow misreads the method parameter here, resulting in a route failer.

I need to MITM the connection to see exactly what the browser is sending and
what Hyper is receiving to see who's wrong.
2016-03-28 02:34:09 -07:00
Sergio Benitez
cddc92f870 Now support Result responses.
Experimented with the new impl specialization features of Rust. They work! But
they're not quite there yet. Specifically, I was able to specialize on
`Responder`, but when trying to remove the macro in `FromParam`, it didn't work.
See https://github.com/rust-lang/rust/issues/31844.
2016-03-22 17:16:17 -07:00
Sergio Benitez
1e9c0789f6 Don't need the type since we use unwrap_or. 2016-03-22 16:28:45 -07:00
Sergio Benitez
877b37c903 Polished examples directory. Fixed File response bug. 2016-03-22 16:27:12 -07:00
Sergio Benitez
433a9119bd It works! Next steps: clean-up, error handling, docs. 2016-03-21 22:04:39 -07:00
Sergio Benitez
5cdb645fc9 Routing is functional! Sort-of. Pretty console colors.
Okay, so, given a URI, we can figure out which route is corresponds to.
Unfortunately, the handler is not yet part of that route, and we're not parsing
the parameters from the path quite yet. But, we're almost there!
2016-03-21 02:22:22 -07:00
Sergio Benitez
b2fbf0d6bd Split up router file into multiple files. Route Collider for strings to Route. 2016-03-20 21:27:17 -07:00
Sergio Benitez
3764afbf1e Cleaned up routing code. It's nearing completion!
* Should be able to write a simple O(n) router using the collision functions.
* Still need to split things up into multiple files.
2016-03-18 19:05:29 -07:00
Sergio Benitez
40559736fc Cleaned up to get rid of warnings. 2016-03-17 20:37:34 -07:00
Sergio Benitez
e4ceabb0e0 Added a travis file. 2016-03-17 20:18:16 -07:00
Sergio Benitez
782536e43f Updated README with more thorough example. 2016-03-17 19:56:23 -07:00
Sergio Benitez
852120e23a Forgot a file, it seems. 2016-03-17 19:43:58 -07:00
Sergio Benitez
2a58800b35 initial implementation of collision detection in routing. 2016-03-17 03:29:55 -07:00
Sergio Benitez
da2b0ed35a Somewhat good infrastructure for params and responses.
Can actually return strings and what-not from a route. Yay!
2016-03-17 01:57:04 -07:00
Sergio Benitez
c6e8cd47da Notes on a perhaps better Body. 2016-03-15 00:47:03 -07:00
Sergio Benitez
dcb150bde7 Something works! A simple hacked-up handler, that is.
At the moment, I simply install the first route I see into the Rocket struct
directly. This is quite terrible. What's worse is that I assume that the Route's
path and handler are static! The handler, actually, does have to be static, but
its response may have whatever (valid) lifetime, though I'm not sure anything
but `static makes sense. I'll think about it.

In any case, the weird `static` restrictions need to be removed, and I need to
think about which lifetimes are safe here. IE: Must all routes be static? Can I
use a closure as a route? (that'd be neat). If so, how do we make that work?

In any case, it's nice to see SOMETHING work. Yay!
2016-03-15 00:41:22 -07:00
Sergio Benitez
4d4985a0e7 Update example. 2016-03-14 20:46:55 -07:00
Sergio Benitez
ad08fe1d04 Major changes. FN params are now being used! Woo!
Subset of list of changes:
  * Split up decorator and macro into their own files.
  * Fully parsing the path parameter and verifying against the function's args.
  * Actually calling methods to fetch and convert the request parameters.
  * Actually calling methods to convert the handler's return type.
  * Sketched out more of the Request/Response structures.

Pretty close to having a fully working MVP.
2016-03-14 20:43:52 -07:00
Sergio Benitez
d5db70afc4 A small README. Because, why not? 2016-03-12 10:54:38 -08:00
Sergio Benitez
2e2cc3c216 Rocket is almost operational! routes! macro complete.
Here's what works so far:

  * The `route` decorator checks its inputs correctly. There's a nice utility
    for doing this, and it's working quite well at the moment.

  * The `route` decorator emits a `route_fn` and a `route_struct`. The `routes`

  * macro prepends the path terminator with the route struct prefix. The

  * `Rocket` library can read mount information (though not act on it properly
    just yet) and launch a server using Hyper.
2016-03-12 10:45:19 -08:00
Sergio Benitez
967fcd26b2 Initial commit. Checking for method and path arguments in route. Not storing the info anywhere yet. 2016-03-07 11:28:04 -08:00