max / quasi
| 1 | //! The emitted template, compiled. |
| 2 | //! |
| 3 | //! `templates/contacts.html` is generated from the description by |
| 4 | //! [`crate::staging::as_askama_template`] and is never hand-edited. Regenerate |
| 5 | //! it with: |
| 6 | //! |
| 7 | //! ```text |
| 8 | //! QUASI_EMIT_TEMPLATE=crates/quasi-bench/templates/contacts.html \ |
| 9 | //! cargo run --release -p quasi-bench --features askama |
| 10 | //! ``` |
| 11 | //! |
| 12 | //! This column is the point of the whole spike. The description is the source, |
| 13 | //! the template is an intermediate nobody writes, and Askama compiles that |
| 14 | //! intermediate to straight-line Rust. If this and the staged column are close, |
| 15 | //! then a semantic starting point costs nothing over a compiled template and |
| 16 | //! the residual can stay a data program; if this is much faster, the gap is |
| 17 | //! enum dispatch and the answer is to generate code rather than a table. |
| 18 | |
| 19 | use Template; |
| 20 | |
| 21 | use crate; |
| 22 | |
| 23 | /// The context the generated template reads. |
| 24 | /// |
| 25 | /// Field names are the ones [`crate::staging::expr`] emits, so the template and |
| 26 | /// this struct move together or the build fails, which is the failure mode to |
| 27 | /// want. |
| 28 | |
| 29 | |
| 30 | pub |
| 31 | pub(crate) count: usize, |
| 32 | pub(crate) buyers: &'a [Buyer], |
| 33 | pub(crate) shared: &'a [Shared], |
| 34 | |
| 35 | |
| 36 | |
| 37 | |
| 38 | pub |
| 39 | Self |
| 40 | count: rows.buyers.len, |
| 41 | buyers: &rows.buyers, |
| 42 | shared: &rows.shared, |
| 43 | |
| 44 | |
| 45 | |
| 46 |