Commit graph

72 commits

Author SHA1 Message Date
Chris Wong
1859f1635c Update Rust
rustc 1.15.0-nightly (7b3eeea22 2016-11-21)
2016-11-23 22:33:04 +13:00
Chris Wong
39602a075c Implement let expressions
Closes 
2016-11-12 14:46:49 +13:00
Utkarsh Kukreti
553a6bc037 Add support for @while and @while let.
Fixes .
2016-10-19 21:46:37 +05:30
Chris Wong
9fa87721e6 Rewrite Render and RenderOnce traits
... to make them more user-friendly.

Closes 
2016-10-08 21:50:59 +13:00
Chris Wong
ba2233f783 Don't put let _ = in front of every statement
This was useful when the `Render*` traits returned `std::fmt::Result`,
but now they're just cruft.
2016-10-06 12:29:07 +13:00
Chris Wong
4284875869 Change escaper to use bytes instead of chars
This removes the overhead from UTF-8 encoding, and makes us faster than
Horrorshow again :)
2016-10-05 20:43:24 +13:00
Chris Wong
e98d340825 Pre-allocate a buffer of (roughly) the right size
Closes 
2016-10-02 17:48:01 +13:00
Chris Wong
c05bb02d97 Remove call expressions 2016-09-23 19:36:42 +12:00
Chris Wong
f12efe4299 Rewrite everything to use Strings instead of writers
After fiddling around with zero-allocation solutions, I concluded that
all non-allocating approaches are too annoying to work with in realistic
code. Using closures leads to yak-shaving with lifetimes; and because
Iron needs to take ownership of the response body we often end up
cloning the input data anyway.

Removing this constraint has let me simplify the entire system, removing
a net 300 lines from the library. The `html!` macro no longer takes a
writer, and instead returns a `PreEscaped<String>`. This means that the
result of an `html!` can be spliced directly into another `html!`,
removing the need for the `impl Template` rigmarole.

To rub it in, benchmarks show the new code is in fact *faster* than it
was before. How lovely.
2016-09-23 19:22:22 +12:00
Chris Wong
9c35cc557e Update Rust 2016-09-18 12:22:02 +12:00
Chris Wong
166296db30 Update Rust 2016-07-03 16:55:45 +12:00
Chris Wong
f1c4e09ac3 Silence "duplicate loop labels" warnings
Closes 
2016-06-12 15:39:12 +12:00
Chris Wong
ca74f0eda0 Update Rust 2016-06-12 15:05:49 +12:00
Circle CI
8f58fe441e Remove another unused import 2016-05-18 19:44:13 +12:00
Chris Wong
1a9080815c Update Rust
See 
2016-02-14 20:12:04 +11:00
Wim Looman
b254d7fbc4 Add support for a match keyword 2016-02-09 19:44:54 +01:00
Wim Looman
6c8fbb5bad Change splice operator and add in render by-move 2016-02-02 15:56:59 +01:00
Chris Wong
05b5d099fb Update Rust 2015-11-08 18:59:11 +13:00
Chris Wong
2e0aa3e433 Replace $$ syntax with a general trait thing 2015-10-06 19:25:29 +13:00
Chris Wong
cf0cf095c2 Revert "Add #call_box instruction"
This reverts commit 0311bab45b.
2015-09-26 13:56:52 +12:00
Chris Wong
7fde2aafb1 Add #[allow(unused_imports)] to generated code 2015-09-25 15:03:00 +12:00
Chris Wong
0311bab45b Add #call_box instruction 2015-09-24 11:50:33 +12:00
Chris Wong
7d124e616e Add #call instruction 2015-09-23 14:29:45 +12:00
Chris Wong
5676895dd9 Make Escaper own the wrapped writer, not borrow it 2015-09-16 12:03:09 +12:00
Chris Wong
c68f98d3a7 Expose Escaper type 2015-09-12 18:48:14 +12:00
Chris Wong
44ca2aa82b Check that the writer implements fmt::Write first 2015-09-07 11:47:25 +12:00
Chris Wong
4c6fe05395 Use match instead of let to hold on to the writer
This fixes a bunch of lifetime issues
2015-09-06 12:10:55 +12:00
Chris Wong
ab45846e1e Use more friendly names in renderer 2015-09-01 18:56:02 +12:00
Chris Wong
1badbd9df2 De-closureify the API
Closes 
2015-09-01 18:26:50 +12:00
Chris Wong
46fab1372b Allow nested macro invocations
Closes 
2015-07-03 10:59:34 +12:00
Chris Wong
d6677b3319 Borrow spliced values instead of moving them
Closes 
2015-04-30 16:32:15 +12:00
Chris Wong
d7d5679e6e Fix typo 2015-04-10 20:21:09 +12:00
Chris Wong
180becbee4 Coalesce the contents of blocks as well 2015-04-10 19:02:36 +12:00
Chris Wong
c507571c5d Coalesce adjacent writes
Fixes 
2015-04-10 19:02:14 +12:00
Chris Wong
e3998645f6 API comment conventions redux 2015-04-08 22:51:21 +12:00
Chris Wong
67daea81d8 Merge 2015-04-04 10:34:31 +13:00
Chris Wong
c75ced0f02 Clean up lifetimes stuff 2015-04-04 10:27:44 +13:00
ArtemGr
3866afbe2a Rust upgrade (seems to need a Clone with a Copy). 2015-04-03 23:41:53 +03:00
Chris Wong
5988d32562 Epic rustup of doom 2015-03-21 13:38:39 +13:00
Chris Wong
333eb46c3a Support if let 2015-03-15 16:23:19 +13:00
Chris Wong
a530d73d25 Implement for expressions 2015-03-14 21:14:11 +13:00
Chris Wong
ef1e305468 Rewrite if expression stuff 2015-03-01 19:56:01 -05:00
Chris Wong
b1e0647192 Remove cow
moo
2015-02-27 17:40:38 +13:00
Chris Wong
9b13557781 Switch to new std::io module 2015-02-18 20:28:44 +13:00
Chris Wong
649be1de09 Remove &: annotation from generated closures 2015-02-10 17:28:52 +13:00
Chris Wong
fa9404872e Refactor toggleable attributes 2015-02-09 15:05:50 +13:00
Chris Wong
1c0d5e9c31 Make the renderer owned instead of borrowed 2015-02-07 17:48:09 +13:00
Chris Wong
f080ee7da1 Epic refactor of doom, redux 2015-02-06 16:26:35 +13:00
Chris Wong
e01af11eaa Update Rust 2015-02-02 20:53:47 +13:00
Chris Wong
110930a558 Epic refactor of doom
* Use `&ExtCtxt` instead of `&mut ExtCtxt`

* Take statements vector by value instead of by reference

* Make control structures easier to write
2015-01-30 18:48:29 +13:00