repo
string
pull_number
int64
instance_id
string
issue_numbers
list
base_commit
string
patch
string
test_patch
string
problem_statement
string
hints_text
string
created_at
string
version
string
updated_at
string
environment_setup_commit
string
FAIL_TO_PASS
list
PASS_TO_PASS
list
FAIL_TO_FAIL
list
PASS_TO_FAIL
list
source_dir
string
rinja-rs/askama
673
rinja-rs__askama-673
[ "671" ]
358f7cd07dc42ba4189d2661461ff0b43a27c304
diff --git a/askama_shared/src/generator.rs b/askama_shared/src/generator.rs --- a/askama_shared/src/generator.rs +++ b/askama_shared/src/generator.rs @@ -246,7 +246,7 @@ struct Generator<'a, S: std::hash::BuildHasher> { next_ws: Option<&'a str>, // Whitespace suppression from the previous non-literal. Will b...
diff --git a/askama_shared/src/lib.rs b/askama_shared/src/lib.rs --- a/askama_shared/src/lib.rs +++ b/askama_shared/src/lib.rs @@ -701,5 +705,14 @@ mod tests { ) .unwrap(); assert_eq!(config.whitespace, WhitespaceHandling::Preserve); + + let config = Config::new( + r#" + ...
Trim all but 1 whitespace jinja condition @vallentin suggested [here](https://github.com/djc/askama/pull/664#pullrequestreview-945253861) that we could extend the "trim_all_whitespace" feature to be able to trim all whitespace characters but one. So currently, we have: ```jinja <div> {%- if foo -%} blabla {%-...
I'm on board with all that, including the proposed operator. Ok, then I'll make a PR soon. :) I like that! For readability I'd like it best if a run of whitespaces becomes a single '\n' if it contains an '\n', or a space otherwise. I'm fine with implementing it this way. Anyone else has an opinion maybe? Yeah, I think ...
2022-04-21T14:51:49Z
0.11
2022-04-26T08:31:21Z
7b6f1df433a7f11612608644342b898cd6be8ff5
[ "filters::json::tests::test_json", "filters::tests::test_abs", "filters::tests::test_center", "filters::tests::test_capitalize", "filters::tests::test_filesizeformat", "filters::tests::test_indent", "filters::tests::test_into_f64", "filters::tests::test_into_isize", "filters::tests::test_join", "f...
[]
[]
[]
auto_2025-06-03
rinja-rs/askama
652
rinja-rs__askama-652
[ "651" ]
b14982f97ffd20039286171d56e6fcfab21f56bc
diff --git a/askama_shared/src/filters/mod.rs b/askama_shared/src/filters/mod.rs --- a/askama_shared/src/filters/mod.rs +++ b/askama_shared/src/filters/mod.rs @@ -330,20 +330,14 @@ where /// Capitalize a value. The first character will be uppercase, all others lowercase. pub fn capitalize<T: fmt::Display>(s: T) -> ...
diff --git a/askama_shared/src/filters/mod.rs b/askama_shared/src/filters/mod.rs --- a/askama_shared/src/filters/mod.rs +++ b/askama_shared/src/filters/mod.rs @@ -655,6 +649,9 @@ mod tests { assert_eq!(capitalize(&"").unwrap(), "".to_string()); assert_eq!(capitalize(&"FoO").unwrap(), "Foo".to_string()...
Capitalize does not work with non ascii chars Capitalize filter only works with ascii chars not chars like å, ä and ö.
This custom filter does what i expected capitalize to do. ```rust mod filters { pub fn cap(s: &str) -> ::askama::Result<String> { match s.chars().next() { Some(c) => { if c.is_lowercase() { let mut replacement: String = c.to_uppercase().collect(); ...
2022-03-26T15:32:24Z
0.11
2022-03-26T17:50:42Z
7b6f1df433a7f11612608644342b898cd6be8ff5
[ "filters::tests::test_capitalize" ]
[ "filters::tests::test_abs", "filters::tests::test_center", "filters::tests::test_filesizeformat", "filters::json::tests::test_json", "filters::tests::test_indent", "filters::tests::test_into_f64", "filters::tests::test_into_isize", "filters::tests::test_join", "filters::tests::test_linebreaks", "f...
[ "filters::yaml::tests::test_yaml" ]
[]
auto_2025-06-03
rinja-rs/askama
359
rinja-rs__askama-359
[ "357" ]
17b9d06814cee84bfd57b73e1941b63187ec5f65
diff --git a/askama_shared/src/filters/mod.rs b/askama_shared/src/filters/mod.rs --- a/askama_shared/src/filters/mod.rs +++ b/askama_shared/src/filters/mod.rs @@ -249,7 +249,7 @@ pub fn indent(s: &dyn fmt::Display, width: &usize) -> Result<String> { #[cfg(feature = "num-traits")] /// Casts number to f64 -pub fn int...
diff --git a/askama_shared/src/filters/mod.rs b/askama_shared/src/filters/mod.rs --- a/askama_shared/src/filters/mod.rs +++ b/askama_shared/src/filters/mod.rs @@ -460,22 +460,22 @@ mod tests { #[test] #[allow(clippy::float_cmp)] fn test_into_f64() { - assert_eq!(into_f64(1).unwrap(), 1.0 as f64); ...
into_f64, into_isize unusable `{{ number | into_f64 }}` expands to `into_f64(&number)`, which doesn't compile, because borrowed number doesn't `impl NumCast`.
Thanks for the report. Would you mind submitting a patch that adds the appropriate `*` operators? Maybe it's better to have info_f64 take `&T`? That's fine, too! Whatever works in the context of Askama filters.
2020-09-16T01:05:50Z
0.10
2020-09-16T09:49:22Z
49252d2457f280026c020d0df46733578eb959a5
[ "filters::tests::test_abs", "filters::tests::test_filesizeformat", "filters::tests::test_center", "filters::tests::test_capitalize", "filters::json::tests::test_json", "filters::tests::test_into_f64", "filters::tests::test_indent", "filters::tests::test_into_isize", "filters::tests::test_lower", "...
[]
[]
[]
auto_2025-06-03
rinja-rs/askama
304
rinja-rs__askama-304
[ "285", "196" ]
cff49453a851029f87b35512f5234a999fea3e6c
diff --git a/askama_shared/src/generator.rs b/askama_shared/src/generator.rs --- a/askama_shared/src/generator.rs +++ b/askama_shared/src/generator.rs @@ -909,7 +909,9 @@ impl<'a, S: std::hash::BuildHasher> Generator<'a, S> { Expr::StrLit(s) => self.visit_str_lit(buf, s), Expr::CharLit(s) => s...
diff --git a/askama_shared/src/parser.rs b/askama_shared/src/parser.rs --- a/askama_shared/src/parser.rs +++ b/askama_shared/src/parser.rs @@ -1078,6 +1098,34 @@ mod tests { super::parse("{{ strvar|e }}", &Syntax::default()); } + #[test] + fn test_parse_var_call() { + assert_eq!( + ...
Call methods on root context Is there a syntax for calling methods implemented directly on the 'context'? A bare `function()` doesn't appear to do the trick Static method call Can I use static method in the template?
I think you can call `self.function()`? Documentation patches welcome. 😊 Can you give a concrete example? Presumably you have tried it? I tried like so: `{% let a = crate::a() %} ` Did you get an error? What was the error? Did you look at the generated code? The print attribute is "all", but it shows only `message: ...
2020-03-15T11:07:43Z
0.9
2020-03-18T21:33:57Z
cff49453a851029f87b35512f5234a999fea3e6c
[ "filters::tests::test_capitalize", "filters::tests::test_center", "filters::tests::test_filesizeformat", "filters::json::tests::test_json", "filters::tests::test_indent", "filters::tests::test_linebreaks", "filters::tests::test_linebreaksbr", "filters::tests::test_join", "filters::tests::test_lower"...
[]
[]
[]
auto_2025-06-03
rinja-rs/askama
861
rinja-rs__askama-861
[ "860" ]
43e92aa3b6b9cd967a70bd0fd54d1f087d6ed76b
diff --git a/askama_parser/src/expr.rs b/askama_parser/src/expr.rs --- a/askama_parser/src/expr.rs +++ b/askama_parser/src/expr.rs @@ -248,15 +248,15 @@ impl<'a> Suffix<'a> { } fn r#macro(i: &'a str) -> IResult<&'a str, Self> { - fn nested_parenthesis(i: &str) -> IResult<&str, ()> { + fn neste...
diff --git a/askama_parser/src/tests.rs b/askama_parser/src/tests.rs --- a/askama_parser/src/tests.rs +++ b/askama_parser/src/tests.rs @@ -788,3 +788,10 @@ fn test_parse_array() { )], ); } + +#[test] +fn fuzzed_unicode_slice() { + let d = "{eeuuu{b&{!!&{!!11{{ + 0!(!1q҄א!)!!!!!!n!"; + as...
Fuzzing askama_parser results in panic Hi, fuzzing `askama_parser` resulted in panic at following line. https://github.com/djc/askama/blob/43e92aa3b6b9cd967a70bd0fd54d1f087d6ed76b/askama_parser/src/expr.rs#L290 I suppose it happens because crash input contains Cyrillic letters which are multi-byte and we need exact b...
2023-09-11T09:42:00Z
0.12
2023-09-11T10:19:21Z
4dab5f91ba15e7c238ddf6223ec7b45eef32cab4
[ "tests::fuzzed_unicode_slice" ]
[ "tests::change_delimiters_parse_filter", "tests::test_missing_space_after_kw", "tests::test_invalid_block - should panic", "tests::test_parse_comments", "tests::test_associativity", "tests::test_parse_const", "tests::test_parse_numbers", "tests::test_odd_calls", "tests::test_parse_root_path", "tes...
[]
[]
auto_2025-06-03
rinja-rs/askama
837
rinja-rs__askama-837
[ "836" ]
9de9af4a006021a63f705e420be4cdef3eb6af82
diff --git a/askama_derive/src/generator.rs b/askama_derive/src/generator.rs --- a/askama_derive/src/generator.rs +++ b/askama_derive/src/generator.rs @@ -1373,7 +1373,7 @@ impl<'a> Generator<'a> { } Expr::Group(ref inner) => self.visit_group(buf, inner)?, Expr::Call(ref obj, ref ...
diff --git a/askama_derive/src/parser/tests.rs b/askama_derive/src/parser/tests.rs --- a/askama_derive/src/parser/tests.rs +++ b/askama_derive/src/parser/tests.rs @@ -221,6 +221,51 @@ fn test_parse_root_path() { ); } +#[test] +fn test_rust_macro() { + let syntax = Syntax::default(); + assert_eq!( + ...
Parse error when using macro with expanded module path I am making a crate that allows people to embed icons from Iconify at compile time, but I ran into a little snag. Tried on main and 0.12. Only happens when using a macro, normal functions work fine. The intended usage is: ```jsx <body> <h1>Hello</h1> ...
Huh, I guess there's some subtlety in the parser relating to the combination of a path, the macro call and the filter. Care to submit a PR? Sure, I'll take a jab at it. Macro invocations are parsed specially, but they should actually be simply suffix expressions, and be handled like normal function calls: https://gi...
2023-07-05T21:49:42Z
0.12
2023-07-24T09:39:14Z
4dab5f91ba15e7c238ddf6223ec7b45eef32cab4
[ "config::tests::find_absolute", "config::tests::find_relative", "config::tests::add_syntax", "config::tests::escape_modes", "config::tests::add_syntax_two", "config::tests::find_relative_sub", "config::tests::get_source", "config::tests::find_relative_nonexistent - should panic", "config::tests::ill...
[]
[]
[]
auto_2025-06-03
rinja-rs/askama
965
rinja-rs__askama-965
[ "962", "961" ]
4dab5f91ba15e7c238ddf6223ec7b45eef32cab4
diff --git a/askama/Cargo.toml b/askama/Cargo.toml --- a/askama/Cargo.toml +++ b/askama/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "askama" -version = "0.12.1" +version = "0.13.0" description = "Type-safe, compiled Jinja-like templates for Rust" documentation = "https://docs.rs/askama" keywords = ["markup", "temp...
diff --git a/askama_derive/src/config.rs b/askama_derive/src/config.rs --- a/askama_derive/src/config.rs +++ b/askama_derive/src/config.rs @@ -299,9 +299,9 @@ pub(crate) fn get_template_source(tpl_path: &Path) -> std::result::Result<String static CONFIG_FILE_NAME: &str = "askama.toml"; static DEFAULT_SYNTAX_NAME: &st...
Remove the need to import askama itself when using integration crates While wording on https://github.com/djc/askama/issues/961, I wandered off to find the cause for the need as the title goes. A rough scan reveals that askama_derive generates some uses of `::askama::`, for example, this: https://github.com/djc/aska...
Well, I wouldn't want to do this in a way that requires adding another intermediate allocation, but perhaps a newtype with a `Display` implementation could do the job. I'd be open to reviewing such a PR. How about checking for existence of `::askama::`, and if so, splitting the `&str` into head, prefix and tail, then 1...
2024-02-13T14:31:39Z
0.12
2024-03-05T10:34:46Z
4dab5f91ba15e7c238ddf6223ec7b45eef32cab4
[ "config::tests::find_absolute", "config::tests::find_relative", "config::tests::find_relative_sub", "config::tests::add_syntax", "config::tests::add_syntax_two", "config::tests::get_source", "config::tests::find_relative_nonexistent - should panic", "config::tests::test_config_whitespace_error", "co...
[]
[]
[]
auto_2025-06-03
rinja-rs/askama
951
rinja-rs__askama-951
[ "924" ]
29b25505b496510217a39606a5f72884867ef492
diff --git a/askama_parser/src/lib.rs b/askama_parser/src/lib.rs --- a/askama_parser/src/lib.rs +++ b/askama_parser/src/lib.rs @@ -349,9 +349,9 @@ fn path_or_identifier(i: &str) -> ParseResult<'_, PathOrIdentifier<'_>> { let rest = rest.as_deref().unwrap_or_default(); // The returned identifier can be assum...
diff --git a/testing/tests/simple.rs b/testing/tests/simple.rs --- a/testing/tests/simple.rs +++ b/testing/tests/simple.rs @@ -484,3 +484,23 @@ fn test_num_literals() { "[90, -90, 90, 2, 56, 240, 10.5, 10.5, 100000000000, 105000000000]", ); } + +#[allow(non_snake_case)] +#[derive(askama::Template)] +#[te...
0.12.1 only allow lower-case variable name in template I don't know if I asked a stupid question, but I spend one day to find it ! my rust version is 1.74.0, I run it on my win11 and WSL ubuntu 22.04, see the same error below ```rust use askama::Template; #[derive(Template)] #[template(path = "hello.html")] str...
I'm new to axum, I have learn the docs https://djc.github.io/askama/askama.html, but it seems not have the request of lower case I suggest you get the macro expansion via Rust Analyzer or via the [debugging](https://djc.github.io/askama/debugging.html) features. I guess the code generator applies some heuristics that t...
2024-01-18T09:50:05Z
0.12
2024-01-18T10:23:22Z
4dab5f91ba15e7c238ddf6223ec7b45eef32cab4
[ "test_attr", "test_comment", "test_composition", "test_constants", "test_define_string_var", "test_else", "test_else_if", "test_empty", "test_escape", "test_func_ref_call", "test_generics", "test_if", "test_literals", "test_index", "test_literals_escape", "test_minus", "test_negation...
[]
[]
[]
auto_2025-06-03
rinja-rs/askama
943
rinja-rs__askama-943
[ "330" ]
84c2094e871b7ef16ab51c77b4a3568794c75638
diff --git a/askama_derive/src/generator.rs b/askama_derive/src/generator.rs --- a/askama_derive/src/generator.rs +++ b/askama_derive/src/generator.rs @@ -1210,6 +1210,20 @@ impl<'a> Generator<'a> { Ok(DisplayWrap::Wrapped) } + fn _visit_as_ref_filter( + &mut self, + buf: &mut Buffer, +...
diff --git a/testing/tests/filters.rs b/testing/tests/filters.rs --- a/testing/tests/filters.rs +++ b/testing/tests/filters.rs @@ -309,3 +309,17 @@ fn test_json_script() { r#"<script>var user = "\u003c/script\u003e\u003cbutton\u003eHacked!\u003c/button\u003e"</script>"# ); } + +#[derive(askama::Template)...
Add support for reference operator (i.e. `{% let x = &y %}`) Sometimes while working with deeply nested structures, it would be useful to create an alias to a field, like say `{% let h = &parent.child.hash %}` At the moment the `&` unary operator is not supported.
Not supporting this has been a design goal from the start. If I remember correctly, your example should already work without `&`. > If I remember correctly, your example should already work without `&`. Unfortunately it doesn't (`hash` here is an owned `HashMap`, and all other structures are owned by `self`): ~~~~ ...
2024-01-10T14:11:35Z
0.12
2024-01-12T10:10:23Z
4dab5f91ba15e7c238ddf6223ec7b45eef32cab4
[ "filter_escape", "filter_format", "filter_fmt", "filter_opt_escaper_html", "filter_opt_escaper_none", "into_numbers_fmt", "test_filter_let_filter", "test_filter_truncate", "test_join", "test_json", "test_json_attribute", "test_json_attribute2", "test_json_script", "test_my_filter", "test...
[]
[]
[]
auto_2025-06-03
rinja-rs/askama
911
rinja-rs__askama-911
[ "904" ]
6cbfde04514a90d4e24350c21ef490c40666d820
diff --git a/askama_derive/src/generator.rs b/askama_derive/src/generator.rs --- a/askama_derive/src/generator.rs +++ b/askama_derive/src/generator.rs @@ -1575,6 +1575,16 @@ impl<'a> Generator<'a> { } buf.write(name); } + Target::OrChain(targets) => match target...
diff --git /dev/null b/testing/templates/match-enum-or.html new file mode 100644 --- /dev/null +++ b/testing/templates/match-enum-or.html @@ -0,0 +1,8 @@ +The card is +{%- match suit %} + {%- when Suit::Clubs or Suit::Spades -%} + {{ " black" }} + {%- when Suit::Diamonds or Suit::Hearts -%} + {{ " red" }} +...
Feature request: enhance match to include multiple targets This has previously been discussed at https://github.com/djc/askama/issues/711#issuecomment-1794340598 but I would like to move it to its own issue as it can be implemented separately. The request is to enhance Askana's syntax for the `match` block (see http...
I'm happy to review a PR for this as proposed.
2023-11-19T18:50:18Z
0.12
2023-11-22T13:56:14Z
4dab5f91ba15e7c238ddf6223ec7b45eef32cab4
[ "test_match_custom_enum", "test_match_literal_char", "test_match_literal", "test_match_literal_num", "test_match_no_whitespace", "test_match_option", "test_match_option_bool", "test_match_option_result_option", "test_match_ref_deref", "test_match_without_with_keyword", "test_match_with_comment" ...
[]
[]
[]
auto_2025-06-03
rinja-rs/askama
910
rinja-rs__askama-910
[ "885" ]
80238d7f48fd86ef939e74df9fdc9678ee78a208
diff --git a/askama_derive/src/generator.rs b/askama_derive/src/generator.rs --- a/askama_derive/src/generator.rs +++ b/askama_derive/src/generator.rs @@ -727,7 +727,50 @@ impl<'a> Generator<'a> { args.len() ))); } - for (expr, arg) in std::iter::zip(args, &def.args) { + ...
diff --git a/testing/tests/macro.rs b/testing/tests/macro.rs --- a/testing/tests/macro.rs +++ b/testing/tests/macro.rs @@ -95,3 +95,31 @@ fn test_macro_self_arg() { let t = MacroSelfArgTemplate { s: "foo" }; assert_eq!(t.render().unwrap(), "foo"); } + +#[derive(Template)] +#[template( + source = "{%- macr...
Allow to have named arguments in macro It'd pretty nice to be able to have named arguments. For example: ``` {% macro menu_link(href, text, target) %} ... {% endmacro menu_link %} ``` Then to be able to call it like this: ``` {% menu_link(href="/something", text="link", target="_blank") %} ``` It make...
I worry that this would be a little foreign to users -- that is, I'm not sure it passes the design test of "it should be obvious how this gets compiled to Rust code". Does it really matter? If this is a big enough concern, we can add a new entry in the askama book explaining how it is generated. It matters to me -- I t...
2023-11-17T13:50:00Z
0.12
2023-11-28T10:54:25Z
4dab5f91ba15e7c238ddf6223ec7b45eef32cab4
[ "test_one_func", "test_one_func_binop", "test_one_func_self", "test_one_func_index", "test_coerce", "test_path_ext_html", "test_path_ext_html_and_ext_txt", "test_path_ext_html_jinja", "test_path_ext_html_jinja_and_ext_txt", "test_path_ext_jinja", "test_path_ext_jinja_and_ext_txt", "filter_esca...
[]
[]
[]
auto_2025-06-03
rinja-rs/askama
401
rinja-rs__askama-401
[ "333", "221", "107" ]
5057b75e7752f2186157fb3e1f5e5d2d0c5ff880
diff --git a/askama_shared/src/generator.rs b/askama_shared/src/generator.rs --- a/askama_shared/src/generator.rs +++ b/askama_shared/src/generator.rs @@ -667,8 +667,26 @@ impl<'a, S: std::hash::BuildHasher> Generator<'a, S> { ", _loop_item) in ::askama::helpers::TemplateLoop::new({}) {{", ...
diff --git a/testing/tests/loops.rs b/testing/tests/loops.rs --- a/testing/tests/loops.rs +++ b/testing/tests/loops.rs @@ -67,3 +67,39 @@ fn test_for_range() { "foo (first)\nfoo (last)\nbar\nbar\nfoo\nbar\nbar\n" ); } + +#[derive(Template)] +#[template(source = "{% for i in [1, 2, 3] %}{{ i }}{% endfor %...
for-loop on values of a BTreeMap inside a template does not compile Hi Askama team, I'm hitting the an issue with for-loops inside template on `(some BTreeMap).values()`. ## Preliminary: what DOES work Consider first the following piece of code, which works, demonstrating that the `values()` function of `BTreeMa...
Allocating a `Vec` just to appease `djc/askama` seems unfortunate. I wonder whether adding something like the `&`-syntax could improve things: ``` {% for &foo in map.values() %} ``` I encountered the same issue trying to iterate over a `BTreeMap` using `.rev()`: ```jinja {% for (date, day_videos) in videos.video...
2020-12-15T06:21:33Z
0.10
2021-02-18T12:18:18Z
49252d2457f280026c020d0df46733578eb959a5
[ "test_for", "test_for_range", "test_precedence_for", "test_nested_for" ]
[]
[]
[]
auto_2025-06-03
rinja-rs/askama
399
rinja-rs__askama-399
[ "397", "397" ]
5b01e605914a49f0b9e71e7dbe7c17ef1de2c522
diff --git a/askama_shared/src/generator.rs b/askama_shared/src/generator.rs --- a/askama_shared/src/generator.rs +++ b/askama_shared/src/generator.rs @@ -444,8 +444,8 @@ impl<'a, S: std::hash::BuildHasher> Generator<'a, S> { Node::Cond(ref conds, ws) => { self.write_cond(ctx, buf,...
diff --git a/testing/tests/gen_ws_tests.py b/testing/tests/gen_ws_tests.py --- a/testing/tests/gen_ws_tests.py +++ b/testing/tests/gen_ws_tests.py @@ -4,12 +4,23 @@ from itertools import product, chain, zip_longest, tee +# The amount of branches to generate +BRANCHES = 2 # branches + IF, ELSE_IF, ELSE, END_IF = 0...
Unwanted whitespace in match arm For a Template struct containing a field `ver: Option<&'a str>` and the following template: ```jinja2 {% let suffix -%} {% match ver -%} {% when Some with (ver) -%} {% let suffix = format!("-{}", ver) -%} {% when None -%} {% let suffix = String::new() -%} {% endmat...
I'm wondering where the whitespace between the `match` and the first `when` should go. Whether it should go into the first match arm or before the match expression (thus "into" all match arms). The whitespace before `endmatch` is self-explanatory. In short: ```jinja {% match ... %}[this whitespace]{% when ... %}...
2020-12-12T16:51:50Z
0.10
2020-12-13T22:08:20Z
49252d2457f280026c020d0df46733578eb959a5
[ "test_match_custom_enum", "test_match_literal_char", "test_match_literal", "test_match_literal_num", "test_match_option", "test_match_ref_deref", "test_extra_whitespace", "test_match_ws" ]
[ "test_match_no_whitespace", "test_cond_ws" ]
[]
[]
auto_2025-06-03
rinja-rs/askama
394
rinja-rs__askama-394
[ "377", "378" ]
810d5ad5067085cc5e4be19903b5804b1ff13430
diff --git a/askama_shared/src/generator.rs b/askama_shared/src/generator.rs --- a/askama_shared/src/generator.rs +++ b/askama_shared/src/generator.rs @@ -505,8 +505,9 @@ impl<'a, S: std::hash::BuildHasher> Generator<'a, S> { let mut has_else = false; for (i, &(cws, ref cond, ref nodes)) in conds.iter...
diff --git /dev/null b/testing/tests/gen_ws_tests.py new file mode 100644 --- /dev/null +++ b/testing/tests/gen_ws_tests.py @@ -0,0 +1,112 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +from itertools import product, chain, zip_longest, tee + + +IF, ELSE_IF, ELSE, END_IF = 0, 1, 2, 3 + +NL = "\\n" +dash = lambda...
Whitespace issue with if conditions Askama seems to be including whitespace from inside an if condition even when the condition is not fulfilled. Here is my template file: ```jinja {%- if some_condition -%} # WARNING {% endif -%} # FILE START ``` What I expected is: - When `some_condition` is `true`: ...
It sure sounds like a bug! Let me look at some code. So the code generation for if statements is here: https://github.com/djc/askama/blob/main/askama_shared/src/generator.rs#L502 I don't immediately see anything obviously wrong. Maybe you can contribute a test case and/or use the debugging facility (add `print = ...
2020-12-03T18:13:39Z
0.10
2020-12-03T21:14:33Z
49252d2457f280026c020d0df46733578eb959a5
[ "test_cond_ws" ]
[]
[]
[]
auto_2025-06-03
rinja-rs/askama
393
rinja-rs__askama-393
[ "331", "331" ]
a199defeca2dfc6aa3e972acca82c96db07f99e9
diff --git a/askama_shared/src/parser.rs b/askama_shared/src/parser.rs --- a/askama_shared/src/parser.rs +++ b/askama_shared/src/parser.rs @@ -1,7 +1,7 @@ use nom::branch::alt; use nom::bytes::complete::{escaped, is_not, tag, take_until}; use nom::character::complete::{anychar, char, digit1}; -use nom::combinator::{...
diff --git a/askama_shared/src/parser.rs b/askama_shared/src/parser.rs --- a/askama_shared/src/parser.rs +++ b/askama_shared/src/parser.rs @@ -1136,6 +1138,25 @@ mod tests { ); } + #[test] + fn test_parse_root_path() { + let syntax = Syntax::default(); + assert_eq!( + supe...
Allow paths to start with `::` [Discovered while working on #315 and #327.] At the moment `{{ std::string::String::new()}}` works but `{{ ::std::string::String::new() }}` doesn't. Allow paths to start with `::` [Discovered while working on #315 and #327.] At the moment `{{ std::string::String::new()}}` works bu...
Alright, that should be fixed. Alright, that should be fixed.
2020-12-02T18:03:44Z
0.10
2020-12-02T19:48:44Z
49252d2457f280026c020d0df46733578eb959a5
[ "parser::tests::test_parse_root_path", "test_attr", "test_composition", "test_comment", "test_define_string_var", "test_else", "test_else_if", "test_empty", "test_escape", "test_func_ref_call", "test_generics", "test_if", "test_literals_escape", "test_index", "test_literals", "test_nes...
[ "filters::tests::test_abs", "filters::json::tests::test_json", "filters::tests::test_capitalize", "filters::tests::test_center", "filters::tests::test_filesizeformat", "filters::tests::test_into_f64", "filters::tests::test_into_isize", "filters::tests::test_indent", "filters::tests::test_join", "f...
[]
[]
auto_2025-06-03
rinja-rs/askama
391
rinja-rs__askama-391
[ "381" ]
f4065b09b91f5d00efa5644915cdd83bfb7d393a
diff --git a/askama_shared/src/parser.rs b/askama_shared/src/parser.rs --- a/askama_shared/src/parser.rs +++ b/askama_shared/src/parser.rs @@ -573,36 +573,32 @@ fn expr_rust_macro(i: &[u8]) -> IResult<&[u8], Expr> { macro_rules! expr_prec_layer { ( $name:ident, $inner:ident, $op:expr ) => { fn $name(i: &...
diff --git a/askama_shared/src/parser.rs b/askama_shared/src/parser.rs --- a/askama_shared/src/parser.rs +++ b/askama_shared/src/parser.rs @@ -1078,12 +1074,13 @@ pub fn parse<'a>(src: &'a str, syntax: &'a Syntax<'a>) -> Result<Vec<Node<'a>>, #[cfg(test)] mod tests { + use super::{Expr, Node, WS}; use crate...
The operator parser gets precedences wrong Consider the expression `a + b == c`. If we changed the code generated from `{lhs} {op} {rhs}` to include parentheses around the entire thing, we get `(a + (b == c))`, which is incorrect, because _(i)_ the `+` and `==` operators combined are not associative (and I think that's...
So precedence is handled here: https://github.com/djc/askama/blob/main/askama_shared/src/parser.rs#L610 I forgot how I wrote this code in the first place, but I'm guessing the associativity aspect is not handled correctly.
2020-12-01T08:40:04Z
0.10
2020-12-01T09:04:25Z
49252d2457f280026c020d0df46733578eb959a5
[ "parser::tests::test_associativity", "parser::tests::test_precedence" ]
[ "filters::tests::test_abs", "filters::tests::test_capitalize", "filters::tests::test_center", "filters::json::tests::test_json", "filters::tests::test_filesizeformat", "filters::tests::test_into_f64", "filters::tests::test_into_isize", "filters::tests::test_indent", "filters::tests::test_linebreaks"...
[]
[]
auto_2025-06-03
rinja-rs/askama
374
rinja-rs__askama-374
[ "368" ]
ac7d9e8031b4df489a0d58dc3459bc931f1ff870
diff --git a/askama_derive/Cargo.toml b/askama_derive/Cargo.toml --- a/askama_derive/Cargo.toml +++ b/askama_derive/Cargo.toml @@ -25,5 +25,4 @@ warp = [] [dependencies] askama_shared = { version = "0.10.4", path = "../askama_shared", default-features = false } proc-macro2 = "1" -quote = "1" syn = "1" diff --git a/...
diff --git a/testing/Cargo.toml b/testing/Cargo.toml --- a/testing/Cargo.toml +++ b/testing/Cargo.toml @@ -15,6 +15,7 @@ serde_json = { version = "1.0", optional = true } [dev-dependencies] criterion = "0.3" +trybuild = "1.0" [[bench]] name = "all" diff --git /dev/null b/testing/tests/ui.rs new file mode 100644...
Consider using `compile_error!` instead of panicking I just tried out askama for the first time and my IDE (using rust-analyzer) reported that my code failed to compile because `proc-macro derive panicked`. This error message is not very helpful as I had to go to the command line and ask cargo what the real problem was...
The simple approach using what syn provides is not enough because many of the potential panics originate from the template parser, which doesn't process Rust code as such. Still, it would surely be nice to use something better than `panic!()`, it just hasn't been much of a priority for me. In the same space, I've also ...
2020-11-02T15:50:35Z
0.10
2020-11-04T00:28:09Z
49252d2457f280026c020d0df46733578eb959a5
[ "ui" ]
[ "filter_escape", "filter_fmt", "filter_format", "into_numbers_fmt", "test_filter_let_filter", "test_filter_truncate", "test_join", "test_nested_filter_ref", "test_my_filter", "test_vec_join", "main", "test_include", "test_deep", "test_different_module", "test_empty_child", "test_let_bl...
[]
[]
auto_2025-06-03
rinja-rs/askama
500
rinja-rs__askama-500
[ "494" ]
49252d2457f280026c020d0df46733578eb959a5
diff --git a/askama_shared/src/generator.rs b/askama_shared/src/generator.rs --- a/askama_shared/src/generator.rs +++ b/askama_shared/src/generator.rs @@ -658,6 +658,12 @@ impl<'a, S: std::hash::BuildHasher> Generator<'a, S> { ", _loop_item) in ::askama::helpers::TemplateLoop::new(((&{}).into_iter())) ...
diff --git a/testing/tests/loops.rs b/testing/tests/loops.rs --- a/testing/tests/loops.rs +++ b/testing/tests/loops.rs @@ -1,3 +1,5 @@ +use std::ops::Range; + use askama::Template; #[derive(Template)] diff --git a/testing/tests/loops.rs b/testing/tests/loops.rs --- a/testing/tests/loops.rs +++ b/testing/tests/loops...
move occurs because `item1.list2` has type `Vec<Box<dyn MyTrait + Send>>`, which does not implement the `Copy` trait I got this error with `main` but not with `0.10.5`. ``` error[E0507]: cannot move out of `item1.list2` which is behind a shared reference --> src/main.rs:3:10 | 3 | #[derive(Template)] | ...
As a workaround, it should work if you change `item1.list2` to `item1.list2.iter()`. However, I'll look into why that fails, as right now I don't recall the reason why it _would_ fail. @vallentin would be great if you can look into this, thanks! @djc I will. I've just been a bit busy the past week and this week, but ...
2021-06-23T16:29:30Z
0.10
2021-06-23T19:41:31Z
49252d2457f280026c020d0df46733578eb959a5
[ "test_for", "test_for_array", "test_for_method_call", "test_for_index", "test_for_range", "test_for_path_call", "test_for_zip_ranges", "test_nested_for", "test_precedence_for" ]
[]
[]
[]
auto_2025-06-03
rinja-rs/askama
499
rinja-rs__askama-499
[ "498" ]
b318d7cbcded2c6dfc66bbe19687f1246a9a9eab
diff --git a/askama_shared/src/generator.rs b/askama_shared/src/generator.rs --- a/askama_shared/src/generator.rs +++ b/askama_shared/src/generator.rs @@ -717,6 +717,7 @@ impl<'a, S: std::hash::BuildHasher> Generator<'a, S> { let mut names = Buffer::new(0); let mut values = Buffer::new(0); + ...
diff --git /dev/null b/testing/templates/nested-macro-args.html new file mode 100644 --- /dev/null +++ b/testing/templates/nested-macro-args.html @@ -0,0 +1,9 @@ +{%- macro outer(first) -%} +{%- call inner(first, "second") -%} +{%- endmacro -%} + +{%- macro inner(first, second) -%} +{{ first }} {{ second }} +{%- endmac...
Error "proc-macro derive produced unparseable tokens" with nested macro call I was working on updating [UniFFI](https://github.com/mozilla/uniffi-rs/) to the latest `main` branch of Askama, and ran into a case where the `#[derive(Template)]` seems to generate invalid code. Below is a reduced example: ``` use askama...
2021-06-21T06:39:19Z
0.10
2021-06-22T09:41:51Z
49252d2457f280026c020d0df46733578eb959a5
[ "test_deep_import", "test_nested", "test_macro", "test_import", "test_short_circuit" ]
[]
[]
[]
auto_2025-06-03
rinja-rs/askama
486
rinja-rs__askama-486
[ "245" ]
92df4d1fe49e8fde5ca13f13b8236102bc16b969
diff --git a/askama_escape/src/lib.rs b/askama_escape/src/lib.rs --- a/askama_escape/src/lib.rs +++ b/askama_escape/src/lib.rs @@ -129,7 +129,6 @@ impl Escaper for Html { b'&' => escaping_body!(start, i, fmt, bytes, "&amp;"), b'"' => escaping_body!(start, i, fmt, bytes, "&quot;...
diff --git a/testing/tests/filters.rs b/testing/tests/filters.rs --- a/testing/tests/filters.rs +++ b/testing/tests/filters.rs @@ -21,7 +21,7 @@ fn filter_escape() { }; assert_eq!( s.render().unwrap(), - "&#x2f;&#x2f; my &lt;html&gt; is &quot;unsafe&quot; &amp; \ + "// my &lt;html&gt; i...
askama_escape Why escape slashes? Sorry, I just don't seem to understand what harm slashes can do in html. [Why does it escape slashes?](https://github.com/djc/askama/blob/467f4ade19fa34983de7e6f6d81c6b4d5ff140fe/askama_escape/src/lib.rs#L134)
Because the OWASP recommends doing so. https://security.stackexchange.com/questions/49852/why-should-xss-filters-escape-forward-slash [OWASP Cross Site Scripting Prevention Cheat Sheet](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Cross_Site_Scripting_Prevention_Cheat_Sheet.md#rule-1---html-esc...
2021-05-16T20:39:00Z
0.10
2021-05-17T19:33:59Z
49252d2457f280026c020d0df46733578eb959a5
[ "filter_escape" ]
[ "filter_format", "filter_fmt", "into_numbers_fmt", "test_filter_let_filter", "test_filter_truncate", "test_join", "test_my_filter", "test_nested_filter_ref", "test_vec_join", "test_attr", "test_comment", "test_composition", "test_constants", "test_define_string_var", "test_else", "test...
[]
[]
auto_2025-06-03
rinja-rs/askama
458
rinja-rs__askama-458
[ "457", "457" ]
96a4328d642191e4925a8f822c9d2cf311f2f9ec
diff --git a/askama_shared/src/generator.rs b/askama_shared/src/generator.rs --- a/askama_shared/src/generator.rs +++ b/askama_shared/src/generator.rs @@ -156,10 +156,7 @@ impl<'a, S: std::hash::BuildHasher> Generator<'a, S> { buf.writeln("}")?; buf.writeln("fn extension(&self) -> Option<&'static st...
diff --git a/askama_shared/src/input.rs b/askama_shared/src/input.rs --- a/askama_shared/src/input.rs +++ b/askama_shared/src/input.rs @@ -227,3 +242,51 @@ impl FromStr for Print { }) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_ext() { + assert_eq!(extension(Pat...
Proper file extension for templates for plugin integration? First of all, let me congratulate you for your work. I'm developing an application with Askama and Rocket, and I'm very happy with the results. However, I recently hit an interesting bump. This was using VS Code as my development environment: - As the templ...
2021-03-09T05:45:50Z
0.10
2021-03-10T12:09:59Z
49252d2457f280026c020d0df46733578eb959a5
[ "filters::tests::test_abs", "filters::json::tests::test_json", "filters::tests::test_capitalize", "filters::tests::test_filesizeformat", "filters::tests::test_center", "filters::tests::test_indent", "filters::tests::test_into_f64", "filters::tests::test_into_isize", "filters::tests::test_linebreaks"...
[]
[]
[]
auto_2025-06-03
rinja-rs/askama
433
rinja-rs__askama-433
[ "432", "291" ]
560d219c269bbf291a4f78e8ef3ffeb0d02ffdef
diff --git a/askama_shared/src/generator.rs b/askama_shared/src/generator.rs --- a/askama_shared/src/generator.rs +++ b/askama_shared/src/generator.rs @@ -1721,8 +1721,11 @@ impl MapChain<'_, &str, LocalMeta> { } fn resolve_or_self(&self, name: &str) -> String { - self.resolve(name) - .unw...
diff --git a/testing/tests/simple.rs b/testing/tests/simple.rs --- a/testing/tests/simple.rs +++ b/testing/tests/simple.rs @@ -72,6 +72,36 @@ fn test_variables_no_escape() { ); } +#[derive(Template)] +#[template( + source = "{{ foo }} {{ foo_bar }} {{ FOO }} {{ FOO_BAR }} {{ self::FOO }} {{ self::FOO_BAR }} ...
Updated book to include urlencode and urlencode_strict Forgot to include these in #429. Question: passing a const, not as a field. I'm trying to reference a constant in my template, since I reuse it all over the place (including across templates) and it'd be a pain to have to update it everywhere it needs to change. ...
As a workaround, try referencing it through a path, for example, from the crate root? Askama tries not to use its knowledge of the context fields, and instead keeps track of local variables, such that everything non-local is treated as a context field. Maybe this can be improved, although I think there were some bene...
2021-01-11T18:51:24Z
0.10
2021-01-13T07:58:54Z
49252d2457f280026c020d0df46733578eb959a5
[ "test_attr", "test_comment", "test_composition", "test_define_string_var", "test_else", "test_else_if", "test_empty", "test_escape", "test_func_ref_call", "test_generics", "test_if", "test_index", "test_literals", "test_minus", "test_literals_escape", "test_nested_attr", "test_negati...
[]
[]
[]
auto_2025-06-03
rinja-rs/askama
426
rinja-rs__askama-426
[ "424", "424" ]
c29ecd68714bddf5e27a9e347c902faa23b2a545
diff --git a/askama_shared/src/parser.rs b/askama_shared/src/parser.rs --- a/askama_shared/src/parser.rs +++ b/askama_shared/src/parser.rs @@ -539,7 +539,7 @@ fn filter(i: &[u8]) -> IResult<&[u8], (&str, Option<Vec<Expr>>)> { } fn expr_filtered(i: &[u8]) -> IResult<&[u8], Expr> { - let (i, (obj, filters)) = tupl...
diff --git a/askama_shared/src/parser.rs b/askama_shared/src/parser.rs --- a/askama_shared/src/parser.rs +++ b/askama_shared/src/parser.rs @@ -1126,7 +1126,41 @@ mod tests { #[test] fn test_parse_filter() { - super::parse("{{ strvar|e }}", &Syntax::default()).unwrap(); + use Expr::*; + ...
Filters have precedence over unary operators Performing e.g. `{{ -2|abs }}` is parsed as `{{ -(2|abs) }}` resulting in `-2` being rendered. Filters have precedence over unary operators Performing e.g. `{{ -2|abs }}` is parsed as `{{ -(2|abs) }}` resulting in `-2` being rendered.
Oops -- we should fix that! Oops -- we should fix that!
2021-01-05T14:44:35Z
0.10
2021-01-05T15:15:20Z
49252d2457f280026c020d0df46733578eb959a5
[ "parser::tests::test_parse_filter" ]
[ "filters::tests::test_abs", "filters::tests::test_center", "filters::json::tests::test_json", "filters::tests::test_capitalize", "filters::tests::test_filesizeformat", "filters::tests::test_indent", "filters::tests::test_into_isize", "filters::tests::test_into_f64", "filters::tests::test_lower", "...
[]
[]
auto_2025-06-03
rinja-rs/askama
423
rinja-rs__askama-423
[ "404", "404" ]
c29ecd68714bddf5e27a9e347c902faa23b2a545
diff --git a/askama_shared/src/filters/json.rs b/askama_shared/src/filters/json.rs --- a/askama_shared/src/filters/json.rs +++ b/askama_shared/src/filters/json.rs @@ -8,8 +8,8 @@ use serde::Serialize; /// /// This will panic if `S`'s implementation of `Serialize` decides to fail, /// or if `T` contains a map with no...
diff --git a/askama_shared/src/filters/json.rs b/askama_shared/src/filters/json.rs --- a/askama_shared/src/filters/json.rs +++ b/askama_shared/src/filters/json.rs @@ -22,6 +22,8 @@ mod tests { #[test] fn test_json() { + assert_eq!(json(Html, true).unwrap().to_string(), "true"); + assert_eq!(js...
Version 0.10 places Copy value literals behind a reference where 0.9 did not I have a large collection of templates that compiles perfectly fine with version 0.9 of askama, but when I try to upgrade to 0.10, I get a bunch of type errors because a bunch of `Copy` types that were previously passed as values now get place...
Sorry for breaking your templates! Are these types being passed to macros, or to custom filters? Can you give an example? We have some things in the works that will hopefully fix this. Just off the top of my head, boolean literals, i.e. `true` and `false` are both passed to functions as `&true` and `&false`, and sim...
2021-01-02T22:39:30Z
0.10
2021-01-05T15:17:19Z
49252d2457f280026c020d0df46733578eb959a5
[ "filters::tests::test_abs", "filters::tests::test_center", "filters::tests::test_capitalize", "filters::json::tests::test_json", "filters::tests::test_into_isize", "filters::tests::test_into_f64", "filters::tests::test_indent", "filters::tests::test_filesizeformat", "filters::tests::test_linebreaks"...
[]
[]
[]
auto_2025-06-03
rinja-rs/askama
411
rinja-rs__askama-411
[ "329", "329" ]
c7697cbd406dce0962618e99a6b78116b14fdb1c
diff --git a/askama_shared/src/generator.rs b/askama_shared/src/generator.rs --- a/askama_shared/src/generator.rs +++ b/askama_shared/src/generator.rs @@ -876,16 +876,34 @@ impl<'a, S: std::hash::BuildHasher> Generator<'a, S> { match *var { Target::Name(name) => { - if !self.local...
diff --git /dev/null b/testing/templates/let-shadow.html new file mode 100644 --- /dev/null +++ b/testing/templates/let-shadow.html @@ -0,0 +1,22 @@ +{%- let a = 1 -%} +{%- let b -%} + +{%- if cond -%} + {%- let b = 22 -%} + {{ b }}- + + {%- let b = 33 -%} + {{ a }}-{{ b }}- +{%- else -%} + {%- let b = 2...
Add support for redefining the same variable with `let` (just as Rust permits) [Discovered while working on #315 and #327.] The following statements, although allowed by Rust, are disallowed by `askama`: ~~~~ {% let x = 1 %} {% let x = 2 %} ~~~~ The failure is: ~~~~ cannot assign twice to immutable variable...
I'm guessing this should be easy to fix. Any news on this? It's very important when splitting template into small parts with ability to `include` them and setting some variables before include. I haven't had a chance to work on it, and it's not much of a priority for me right now. I might be able to mentor you if you w...
2020-12-23T14:44:36Z
0.10
2020-12-25T21:42:49Z
49252d2457f280026c020d0df46733578eb959a5
[ "test_if_let", "test_let", "test_let_decl", "test_self_iter", "test_let_tuple" ]
[]
[]
[]
auto_2025-06-03
rinja-rs/askama
1,097
rinja-rs__askama-1097
[ "1086" ]
53b4b518f9a230665029560df038c318b2e55458
diff --git a/askama_parser/src/expr.rs b/askama_parser/src/expr.rs --- a/askama_parser/src/expr.rs +++ b/askama_parser/src/expr.rs @@ -270,7 +270,7 @@ impl<'a> Expr<'a> { separated_list0(char(','), ws(move |i| Self::parse(i, level))), Self::Array, ), - ...
diff --git a/testing/tests/loops.rs b/testing/tests/loops.rs --- a/testing/tests/loops.rs +++ b/testing/tests/loops.rs @@ -83,6 +83,16 @@ fn test_for_array() { assert_eq!(t.render().unwrap(), "123"); } +#[derive(Template)] +#[template(source = "{% for i in [1, 2, 3, ] %}{{ i }}{% endfor %}", ext = "txt")] +stru...
Allow Trailing Commas in Arrays Inside Template Expressions Basically what the title says. To give an example of what I mean, this here compiles just fine: ```html <nav class="flex justify-between items-center max-w-7xl gap-x-12"> {% for (route, name) in [ ("/about", "About"), ("/contact",...
Should be easy enough to implement, do you want to try submitting a PR? You'll want to start here: https://github.com/djc/askama/blob/main/askama_parser/src/expr.rs#L263 Oh yeah sure! I'll see to it once I have the time. Doesn't look too complicated at first glance.
2024-09-27T14:22:20Z
0.13
2024-09-28T09:55:54Z
53b4b518f9a230665029560df038c318b2e55458
[ "test_for", "test_for_array", "test_for_cycle", "test_for_cycle_dynamic", "test_for_cycle_empty", "test_for_destructoring_ref_tuple", "test_for_enumerate", "test_for_destructoring_tuple", "test_for_in_if", "test_for_index", "test_for_method_call", "test_for_path_call", "test_for_range", "t...
[]
[]
[]
auto_2025-06-03
rinja-rs/askama
1,093
rinja-rs__askama-1093
[ "1063" ]
668bd6f2c1f60dc25143360976a5c775901af889
diff --git a/askama_derive/src/generator.rs b/askama_derive/src/generator.rs --- a/askama_derive/src/generator.rs +++ b/askama_derive/src/generator.rs @@ -822,6 +822,7 @@ impl<'a> Generator<'a> { }; let locals = MapChain::with_parent(&self.locals); let mut child = Self::new(self.input, self.c...
diff --git /dev/null b/testing/templates/fragment-include.html new file mode 100644 --- /dev/null +++ b/testing/templates/fragment-include.html @@ -0,0 +1,9 @@ +{% extends "fragment-base.html" %} + +{% block body %} +{% include "included.html" %} +{% endblock %} + +{% block other_body %} +<p>Don't render me.</p> +{% en...
Include statement has no effect when used from a block fragment When using a block fragment include statements don't seem to work. See https://github.com/OscartGiles/askama/commit/74162b9453486a53a4de40bba905b4be31dcf3f0 for an example. Is this intented behaviour or a bug?
2024-09-11T03:39:27Z
0.13
2024-09-11T17:40:47Z
53b4b518f9a230665029560df038c318b2e55458
[ "test_fragment_include" ]
[ "test_fragment_nested_block", "test_fragment_simple", "test_fragment_nested_super", "test_fragment_super", "test_fragment_unused_expression", "test_specific_block" ]
[]
[]
auto_2025-06-03
rinja-rs/askama
1,057
rinja-rs__askama-1057
[ "1056" ]
627d58bc3b93c484f190d0711a4f9a9e26bc062c
diff --git a/askama_parser/src/node.rs b/askama_parser/src/node.rs --- a/askama_parser/src/node.rs +++ b/askama_parser/src/node.rs @@ -369,24 +369,20 @@ pub struct Cond<'a> { impl<'a> Cond<'a> { fn parse(i: &'a str, s: &State<'_>) -> ParseResult<'a, Self> { - let mut p = tuple(( + let (i, (_, pws,...
diff --git /dev/null b/testing/tests/if.rs new file mode 100644 --- /dev/null +++ b/testing/tests/if.rs @@ -0,0 +1,26 @@ +use askama::Template; + +#[derive(Template)] +#[template( + source = r#"{%- if s == "" -%} +empty +{%- else if s == "b" -%} +b +{%- elif s == "c" -%} +c +{%- else -%} +else +{%- endif -%}"#, + ...
Add `elif` keyword Hi, we recently migrated from Tera to Askama and overall it was quite straightforward. One thing that did not work out of the box was the `elif` keyword, so it would be nice to include that. In addition, `elif` seems to be [supported by jinja](https://jinja.palletsprojects.com/en/3.1.x/templates/...
I guess I'm open to having that added as an alias for `else if`. Would you be able to submit a PR? The code is here: https://github.com/djc/askama/blob/main/askama_parser/src/node.rs#L375. Ah cool. :D
2024-05-23T10:19:41Z
0.13
2024-05-23T12:28:00Z
53b4b518f9a230665029560df038c318b2e55458
[ "test_if_let", "test_if_let_else", "test_if_let_shadowing", "test_if_let_struct", "test_if_let_struct_ref" ]
[]
[]
[]
auto_2025-06-03
rinja-rs/askama
1,029
rinja-rs__askama-1029
[ "1022" ]
03690ab46bbb9cc10f688ebfe003986f9cf4999c
diff --git a/askama_derive/src/generator.rs b/askama_derive/src/generator.rs --- a/askama_derive/src/generator.rs +++ b/askama_derive/src/generator.rs @@ -705,7 +705,7 @@ impl<'a> Generator<'a> { break; } } - let current_buf = mem::take(&mut self.buf_writable); + let...
diff --git /dev/null b/testing/templates/blocks.txt new file mode 100644 --- /dev/null +++ b/testing/templates/blocks.txt @@ -0,0 +1,11 @@ +{% block index %} +Section: {{ s1 }} +{% endblock %} + +{% block section -%} + [ + {%- for value in values -%} + {{ value }} + {%- endfor -%} + ] +{%- endblock %} diff --gi...
Compilation error when using nested template blocks with in a single template file Hello! I Encountered a compilation error when using[ block fragments](https://github.com/djc/askama/pull/824) with Vec<&str> in a single template file. The error does not occur when the template is split into separate files. This is w...
I had the same issue, investigating what's going on.
2024-05-02T15:40:27Z
0.13
2024-05-16T12:07:05Z
53b4b518f9a230665029560df038c318b2e55458
[ "test_fragment_nested_block", "test_fragment_simple", "test_fragment_nested_super", "test_fragment_super", "test_fragment_unused_expression" ]
[ "test_deep", "test_different_module", "test_empty_child", "test_flat_deep", "test_let_block", "test_named_end", "test_nested_blocks", "test_use_base_directly", "test_simple_extends", "test_attr", "test_comment", "test_constants", "test_composition", "test_else", "test_define_string_var",...
[]
[]
auto_2025-06-03
tracel-ai/burn
2,224
tracel-ai__burn-2224
[ "2080" ]
a9abd8f7462bb2c4976f8338ef3e25c5aa7d57eb
diff --git a/crates/burn-jit/src/kernel/interpolate/bicubic.rs b/crates/burn-jit/src/kernel/interpolate/bicubic.rs --- a/crates/burn-jit/src/kernel/interpolate/bicubic.rs +++ b/crates/burn-jit/src/kernel/interpolate/bicubic.rs @@ -100,6 +100,7 @@ impl<E: JitElement> InterpolateBicubicShader<E> { cpa!(scope, ...
diff --git a/crates/burn-import/onnx-tests/tests/test_onnx.rs b/crates/burn-import/onnx-tests/tests/test_onnx.rs --- a/crates/burn-import/onnx-tests/tests/test_onnx.rs +++ b/crates/burn-import/onnx-tests/tests/test_onnx.rs @@ -962,7 +962,6 @@ mod tests { } #[test] - #[ignore = "https://github.com/tracel-...
NaN for `[N, C, 1, W]` interpolate inputs with bilinear and bicubic modes for burn-wgpu and burn-ndarray backends **Describe the bug** NaN values when the input tensor is `[N, C, 1, W]` shape. **To Reproduce** 1. Enable `test_1d_bilinear` test in `crates/burn-tensor/src/tests/module/bilinear_interpolate.rs` and...
Ignored tests just in case the code gets deleted: ```rust #[test] #[ignore = "https://github.com/tracel-ai/burn/issues/2080"] fn test_1d_bicubic() { // Initialize the model without weights (because the exported file does not contain them) let device = Default::default(); /...
2024-08-30T15:12:45Z
0.15
2024-09-01T20:37:48Z
3b51c26958128502d60fb35029c43d9b686b816c
[ "tests::resize_with_scales_1d_linear" ]
[ "tests::greater_scalar", "tests::greater_or_equal_scalar", "tests::log", "tests::expand_shape", "tests::expand", "tests::flatten", "tests::less_or_equal_scalar", "tests::resize_with_sizes", "tests::shape", "tests::clip_opset7", "tests::greater", "tests::globalavrpool_1d_2d", "tests::greater_...
[]
[]
auto_2025-06-10
tracel-ai/burn
1,902
tracel-ai__burn-1902
[ "1893" ]
a04da9a2850c3c8b32d4552eab1c4240e27e7983
diff --git a/crates/burn-core/src/module/param/primitive.rs b/crates/burn-core/src/module/param/primitive.rs --- a/crates/burn-core/src/module/param/primitive.rs +++ b/crates/burn-core/src/module/param/primitive.rs @@ -21,6 +21,12 @@ where } fn load_record(self, record: Self::Record) -> Self { + let ...
diff --git a/crates/burn-core/src/module/param/primitive.rs b/crates/burn-core/src/module/param/primitive.rs --- a/crates/burn-core/src/module/param/primitive.rs +++ b/crates/burn-core/src/module/param/primitive.rs @@ -267,3 +281,28 @@ impl_module_tuple!([L0, L1, L2, L3, L4, L5, L6][0, 1, 2, 3, 4, 5, 6]); impl_module_...
The `model.load_record()` method turns off the activation function during the forward pass **Describe the bug** The `model.load_record()` method turns off the activation function during the forward pass. **To Reproduce** 1. Initialize the model with the ReLU activation function. 2. Perform a forward pass with inp...
Hmm well ReLU has no parameters so it's not saved with the weights, which explains why it's initialized to the default value `None` when loading the state from the saved record. For an optional layer with parameters it will work. In the meantime, you can manually set the activation yourself after loading the weights. ...
2024-06-17T13:20:13Z
0.14
2024-06-18T20:45:22Z
978ac6c4ecbb4e223c6f0f6361fae982f89e5fde
[ "module::param::primitive::tests::dont_override_constant_module_when_loading_none_record" ]
[ "lr_scheduler::cosine::test::config_initial_lr_too_high - should panic", "lr_scheduler::cosine::test::config_initial_lr_too_low - should panic", "lr_scheduler::cosine::test::config_min_lr_too_high - should panic", "lr_scheduler::cosine::test::config_min_lr_too_low - should panic", "lr_scheduler::cosine::tes...
[]
[]
auto_2025-06-10
tracel-ai/burn
923
tracel-ai__burn-923
[ "912" ]
64e58b44639e3265ba002a0f71d06a7b584ece9e
diff --git a/burn-train/src/renderer/tui/progress.rs b/burn-train/src/renderer/tui/progress.rs --- a/burn-train/src/renderer/tui/progress.rs +++ b/burn-train/src/renderer/tui/progress.rs @@ -1,22 +1,20 @@ -use crate::renderer::TrainingProgress; - use super::TerminalFrame; +use crate::renderer::TrainingProgress; use r...
diff --git a/burn-train/src/renderer/tui/progress.rs b/burn-train/src/renderer/tui/progress.rs --- a/burn-train/src/renderer/tui/progress.rs +++ b/burn-train/src/renderer/tui/progress.rs @@ -167,9 +232,29 @@ mod tests { }; let starting_epoch = 8; - let progress = calculate_progress(&progress,...
Autotune causes inaccurate estimated training time The autotune mechanism runs many benchmarks at the beginning of a training execution, then the best operations are stored and used directly throughout the rest of the training. However, the estimated training time shown in the UI is computed with the time spent on ...
@nathanielsimard 's simple solution: wait about 30 secs before computing the estimated time
2023-11-01T20:33:01Z
0.2
2023-11-03T12:57:12Z
306619629797ad4bd631a60560c198e3113f25bf
[ "checkpoint::strategy::lastn::tests::should_always_delete_lastn_epoch_if_higher_than_one", "checkpoint::strategy::composed::tests::should_delete_when_both_deletes", "metric::acc::tests::test_accuracy_without_padding", "metric::acc::tests::test_accuracy_with_padding", "renderer::tui::progress::tests::calcula...
[]
[]
[]
auto_2025-06-10
tracel-ai/burn
888
tracel-ai__burn-888
[ "834" ]
d021c7d7e8d82ddf38d396e1a05d8fdf8244a87e
diff --git a/burn-core/src/optim/adamw.rs b/burn-core/src/optim/adamw.rs --- a/burn-core/src/optim/adamw.rs +++ b/burn-core/src/optim/adamw.rs @@ -150,7 +150,7 @@ impl AdaptiveMomentumW { let factor = 1.0 - self.beta_2; let moment_2 = grad.powf(2.0).mul_scalar(factor); - AdaptiveM...
diff --git a/burn-core/src/optim/adamw.rs b/burn-core/src/optim/adamw.rs --- a/burn-core/src/optim/adamw.rs +++ b/burn-core/src/optim/adamw.rs @@ -228,7 +228,7 @@ mod tests { assert_eq!(state_optim_before.len(), state_optim_after.len()); } - const ASSERT_PRECISION: usize = 6; + const ASSERT_PRECIS...
AdamW NaN When learning with AdamW, we get NaNs. I did not investigate in details, but we had a similar problem with Adam. I think it's related to a division by zero occurring because we start at time 0. In Adam we start at time 1 to fix that problem, but changing this value might have an incidence on the algorit...
2023-10-23T15:28:20Z
0.2
2023-10-24T18:48:43Z
306619629797ad4bd631a60560c198e3113f25bf
[ "optim::adamw::tests::test_adam_optimizer_no_nan" ]
[ "module::param::constant::tests::empty_module_with_phantom", "lr_scheduler::noam::tests::test_function_increase_and_decrease", "grad_clipping::base::tests::test_clip_by_norm", "nn::attention::mask::tests::test_generate_autoregressive_mask", "nn::attention::mask::tests::test_generate_padding_mask", "data::...
[]
[]
auto_2025-06-10
tracel-ai/burn
815
tracel-ai__burn-815
[ "814" ]
d7e9e750992229ed6a47101341f4630705fd564c
diff --git a/burn-train/src/learner/builder.rs b/burn-train/src/learner/builder.rs --- a/burn-train/src/learner/builder.rs +++ b/burn-train/src/learner/builder.rs @@ -258,9 +258,9 @@ where if self.log_to_file { self.init_logger(); } - let renderer = self - .renderer - ...
diff --git a/burn-train/src/metric/dashboard/tui/progress.rs b/burn-train/src/metric/dashboard/tui/progress.rs --- a/burn-train/src/metric/dashboard/tui/progress.rs +++ b/burn-train/src/metric/dashboard/tui/progress.rs @@ -130,6 +139,7 @@ fn format_eta(eta_secs: u64) -> String { #[cfg(test)] mod tests { use supe...
Dashboard shows wrong remaining time estimate when resuming from checkpoint **Describe the bug** <!-- A clear and concise description of what the bug is. --> Resuming a training from a checkpoint will show the progress bar let's say at 25% and remaining time is not calculated based on the time per batch and number of...
We should compute the time remaining ignoring the previous epochs. The estimate will probably be fine in that case.
2023-09-18T22:03:22Z
8.0
2023-09-21T12:52:08Z
bdcd5873c526ab27699692c00f9025ae80619948
[ "metric::dashboard::tui::progress::tests::test_format_eta", "metric::acc::tests::test_accuracy_without_padding", "metric::acc::tests::test_accuracy_with_padding", "metric::dashboard::tui::full_history::tests::test_points", "metric::dashboard::tui::recent_history::tests::test_push_update_bounds_max_y", "me...
[]
[]
[]
auto_2025-06-10
tracel-ai/burn
799
tracel-ai__burn-799
[ "795" ]
dbc5f0a340136251170138f8825062b42ed2d096
diff --git a/burn-import/src/burn/node/clip.rs b/burn-import/src/burn/node/clip.rs --- a/burn-import/src/burn/node/clip.rs +++ b/burn-import/src/burn/node/clip.rs @@ -1,5 +1,5 @@ use super::{Node, NodeCodegen}; -use crate::burn::{BurnImports, Scope, TensorType, Type}; +use crate::burn::{Scope, TensorType, Type}; use ...
diff --git a/burn-import/src/burn/node/clip.rs b/burn-import/src/burn/node/clip.rs --- a/burn-import/src/burn/node/clip.rs +++ b/burn-import/src/burn/node/clip.rs @@ -73,7 +70,6 @@ mod tests { graph.register_input_output(vec!["tensor1".to_string()], vec!["tensor2".to_string()]); let expected = quote...
How to use .clamp() with a generic backend? I fear I've probably missed something here, so a pointer in the right direction would be appreciated. As I understand it, we're supposed to define our model with just B: Backend, and only use a concrete definition in our entrypoint. We ran into trouble using .clamp() with thi...
Does this happen for other ops or just with .clamp()? I wander if I correctly implemented this op. Here is the PR responsible for this introduction: https://github.com/burn-rs/burn/pull/550 Yes, you have to use element conversion trait, but the API should be generic over the element type, so I'll make a fix. ```rust...
2023-09-12T15:32:02Z
8.0
2023-09-12T18:20:15Z
bdcd5873c526ab27699692c00f9025ae80619948
[ "burn::node::clip::tests::codegen_nodes_max", "burn::node::clip::tests::codegen_nodes_min_max", "burn::node::clip::tests::codegen_nodes_min" ]
[ "burn::node::binary::tests::test_binary_codegen_sub_scalars", "burn::node::dropout::tests::test_codegen", "burn::node::global_avg_pool::tests::test_codegen_2d", "burn::node::batch_norm::tests::test_codegen", "burn::node::conv1d::tests::test_codegen", "burn::node::avg_pool2d::tests::test_codegen", "burn:...
[]
[]
auto_2025-06-10
tracel-ai/burn
572
tracel-ai__burn-572
[ "541" ]
597eab524d7232a9798487f094c51ffc2c81f545
diff --git a/burn-autodiff/src/ops/module.rs b/burn-autodiff/src/ops/module.rs --- a/burn-autodiff/src/ops/module.rs +++ b/burn-autodiff/src/ops/module.rs @@ -38,12 +38,11 @@ impl<B: Backend> ModuleOps<ADBackendDecorator<B>> for ADBackendDecorator<B> { } fn embedding_backward( - weights: ADTensor<B, ...
diff --git /dev/null b/burn-autodiff/src/tests/adaptive_avgpool2d.rs new file mode 100644 --- /dev/null +++ b/burn-autodiff/src/tests/adaptive_avgpool2d.rs @@ -0,0 +1,64 @@ +#[burn_tensor_testgen::testgen(ad_adaptive_avg_pool2d)] +mod tests { + use super::*; + use burn_tensor::module::adaptive_avg_pool2d; + us...
Adaptive average pooling Implement adaptive average pooling in all backends. - [ ] ndarray - [ ] tch - [ ] wgpu - [ ] autodiff
2023-08-01T15:30:16Z
7.0
2023-08-04T14:24:02Z
8808ee265ed366b0e263ec7221854df0c956993f
[ "burn::node::unary::tests::test_unary_codegen_sigmoid", "burn::node::concat::tests::test_codegen_concat", "burn::node::reshape::tests::test_codegen_nodes", "burn::node::batch_norm::tests::test_codegen", "burn::node::unary::tests::test_unary_codegen_transpose", "burn::node::unary::tests::test_unary_codegen...
[ "tensor::api::check::tests::binary_ops_devices - should panic", "tensor::api::check::tests::binary_ops_shapes_no_broadcast - should panic", "tensor::api::check::tests::binary_ops_shapes_with_broadcast", "tensor::api::check::tests::index_range_exceed_number_of_dimensions - should panic", "tensor::api::check:...
[]
[]
auto_2025-06-10
tracel-ai/burn
390
tracel-ai__burn-390
[ "388" ]
bff752b1a86208be6515d6393b752c748f2206cd
diff --git a/burn-tensor/src/tensor/data.rs b/burn-tensor/src/tensor/data.rs --- a/burn-tensor/src/tensor/data.rs +++ b/burn-tensor/src/tensor/data.rs @@ -1,9 +1,9 @@ use alloc::format; +use alloc::string::String; use alloc::vec::Vec; use crate::{tensor::Shape, Element, ElementConversion}; -use libm::{pow, round...
diff --git a/burn-tensor/src/tensor/data.rs b/burn-tensor/src/tensor/data.rs --- a/burn-tensor/src/tensor/data.rs +++ b/burn-tensor/src/tensor/data.rs @@ -387,4 +407,30 @@ mod tests { let data = Data::from([3.0, 5.0, 6.0]); assert_eq!(data.shape, Shape::new([3])); } + + #[test] + fn should_...
Intermittent test failure CI has failed due to this error but it worked when restarted: ``` error: test failed, to rerun pass `--lib` failures: ---- nn::transformer::decoder::tests::test_autoregressive_norm_last stdout ---- thread 'nn::transformer::decoder::tests::test_autoregressive_norm_last' panicked at ...
2023-06-06T18:10:48Z
5.0
2023-06-06T18:34:25Z
8ed0775dfdd76ef950fce94fb3fbf7a0aaad957c
[ "tensor::data::tests::should_assert_appox_eq_limit" ]
[ "tensor::api::check::tests::binary_ops_shapes_no_broadcast - should panic", "tensor::api::check::tests::binary_ops_shapes_with_broadcast", "tensor::api::check::tests::binary_ops_devices - should panic", "tensor::api::check::tests::index_range_exceed_dimension - should panic", "tensor::api::check::tests::ind...
[]
[]
auto_2025-06-10
tracel-ai/burn
1,682
tracel-ai__burn-1682
[ "1672" ]
6c708527b933d67a49bca29e119ff6b4f1ebcb1e
diff --git a/crates/burn-core/src/nn/linear.rs b/crates/burn-core/src/nn/linear.rs --- a/crates/burn-core/src/nn/linear.rs +++ b/crates/burn-core/src/nn/linear.rs @@ -64,9 +64,14 @@ impl<B: Backend> Linear<B> { /// /// # Shapes /// - /// - input: `[..., any, d_input]` - /// - output: `[..., any, d_...
diff --git a/crates/burn-core/src/nn/linear.rs b/crates/burn-core/src/nn/linear.rs --- a/crates/burn-core/src/nn/linear.rs +++ b/crates/burn-core/src/nn/linear.rs @@ -150,4 +155,23 @@ mod tests { assert_eq!(result.into_data(), expected_result.into_data()); } + + #[test] + fn test_linear_1d() { + ...
Support forward without a batch dimension ### Feature description Support forward without a batch dimension ### Feature motivation Linear model import from pytorch cannot be used as it for example. Imported model work with tensor of rank 1 but Burn Linear doesn't not support tensor of rank 1 at this time. As d...
2024-04-22T16:41:55Z
0.14
2024-04-22T22:39:09Z
978ac6c4ecbb4e223c6f0f6361fae982f89e5fde
[ "nn::linear::tests::test_linear_1d" ]
[ "lr_scheduler::cosine::test::config_initial_lr_too_high - should panic", "lr_scheduler::cosine::test::config_initial_lr_too_low - should panic", "lr_scheduler::cosine::test::config_min_lr_too_high - should panic", "lr_scheduler::cosine::test::config_min_lr_too_low - should panic", "lr_scheduler::cosine::tes...
[]
[]
auto_2025-06-10
tracel-ai/burn
1,657
tracel-ai__burn-1657
[ "1642" ]
7705fd9c25cf6ca201da5652605cf2f46c363086
diff --git a/crates/burn-import/src/burn/node/unary.rs b/crates/burn-import/src/burn/node/unary.rs --- a/crates/burn-import/src/burn/node/unary.rs +++ b/crates/burn-import/src/burn/node/unary.rs @@ -198,8 +198,9 @@ impl UnaryNode { Self::new(input, output, UnaryNodeKind::Tanh, Rc::new(function)) } - ...
diff --git a/crates/burn-import/onnx-tests/tests/onnx_tests.rs b/crates/burn-import/onnx-tests/tests/onnx_tests.rs --- a/crates/burn-import/onnx-tests/tests/onnx_tests.rs +++ b/crates/burn-import/onnx-tests/tests/onnx_tests.rs @@ -685,18 +685,23 @@ mod tests { let model: transpose::Model<Backend> = transpose::...
Incorrect implementation of Transpose ONNX operation **Describe the bug** This PR https://github.com/tracel-ai/burn/pull/546/files incorrectly implemented transpose operation. Instead of using permute operator, this uses transpose Burn operator which only flips last two dimensions.
CCing @laggui , @nathanielsimard
2024-04-18T14:41:01Z
0.14
2024-04-19T13:34:04Z
978ac6c4ecbb4e223c6f0f6361fae982f89e5fde
[ "burn::node::binary::tests::test_binary_codegen_div_scalars", "burn::node::unary::tests::test_unary_codegen_tanh", "burn::node::unary::tests::test_unary_neg_tensor", "burn::node::unsqueeze::tests::test_codegen_nodes", "burn::node::conv_transpose_2d::tests::test_codegen", "burn::node::binary::tests::test_b...
[]
[]
[]
auto_2025-06-10
tracel-ai/burn
1,188
tracel-ai__burn-1188
[ "1112" ]
f5ac5d8e9f7743bb82b36bc3ab824ec621b95c69
diff --git a/backend-comparison/Cargo.toml b/backend-comparison/Cargo.toml --- a/backend-comparison/Cargo.toml +++ b/backend-comparison/Cargo.toml @@ -23,7 +23,7 @@ ndarray-blas-openblas = ["burn/ndarray", "burn/openblas"] tch-cpu = ["burn/tch"] tch-gpu = ["burn/tch"] wgpu = ["burn/wgpu"] -wgpu-fusion = ["burn/wgpu"...
diff --git a/burn-compute/src/client.rs b/burn-compute/src/client.rs --- a/burn-compute/src/client.rs +++ b/burn-compute/src/client.rs @@ -72,12 +72,18 @@ where } /// Executes the fastest kernel in the autotune operation, using (cached) runtime benchmarks - pub fn execute_autotune( + pub fn autotune_e...
Support autotune of fused compute shaders When creating new shaders, we should be able to execute them with different launch options based on benchmarks performed by the autotune system.
2024-01-29T23:02:56Z
0.12
2024-02-01T17:58:26Z
f5ac5d8e9f7743bb82b36bc3ab824ec621b95c69
[ "memory_management::simple::tests::never_dealloc_strategy_never_deallocs", "memory_management::simple::tests::period_tick_dealloc_strategy_should_dealloc_after_period", "memory_management::simple::tests::slice_strategy_maximum_bytes", "memory_management::simple::tests::can_mut_with_single_tensor_reference", ...
[]
[]
[]
auto_2025-06-10
tracel-ai/burn
1,087
tracel-ai__burn-1087
[ "911" ]
b17ac2dfba451fe24e22bbe2a63de84277b0c09e
diff --git a/.gitignore b/.gitignore --- a/.gitignore +++ b/.gitignore @@ -5,7 +5,8 @@ Cargo.lock .DS_Store .cargo/config.toml +.dir-locals.el .idea .vscode -.fleet .vs +.fleet diff --git a/burn-common/Cargo.toml b/burn-common/Cargo.toml --- a/burn-common/Cargo.toml +++ b/burn-common/Cargo.toml @@ -29,6 +29,7 @@...
diff --git a/burn-compute/Cargo.toml b/burn-compute/Cargo.toml --- a/burn-compute/Cargo.toml +++ b/burn-compute/Cargo.toml @@ -30,9 +39,14 @@ derive-new = { workspace = true } spin = { workspace = true } log = { workspace = true } hashbrown = { workspace = true } +dirs = { workspace = true , optional = true} +serde ...
Autotune: benchmarks cached on disk The autotune mechanism uses a cache to check if, for a specific operation on an input size within a specific range, the benchmarks have already been computed. If so, the fastest operation in that setting on your machine is stored in the cache and we just use this one. That way, it is...
From tuner in burn-compute: ```rust fn autotuning( &mut self, autotune_operation_set: Box<dyn AutotuneOperationSet<S::AutotuneKey>>, client: &ComputeClient<S, C>, ) -> Box<dyn AutotuneOperation> { let key = autotune_operation_set.key(); let autotunables = autotune_...
2023-12-20T04:21:34Z
0.12
2024-01-05T19:19:33Z
f5ac5d8e9f7743bb82b36bc3ab824ec621b95c69
[ "memory_management::simple::tests::never_dealloc_strategy_never_deallocs", "memory_management::simple::tests::period_tick_dealloc_strategy_should_dealloc_after_period", "memory_management::simple::tests::slice_strategy_maximum_bytes", "memory_management::simple::tests::can_mut_with_single_tensor_reference", ...
[]
[]
[]
auto_2025-06-10
tracel-ai/burn
978
tracel-ai__burn-978
[ "636" ]
cdf54d0b40d513ea1ae2cf1a4335b60e6248e039
diff --git a/burn-core/src/nn/pool/avg_pool2d.rs b/burn-core/src/nn/pool/avg_pool2d.rs --- a/burn-core/src/nn/pool/avg_pool2d.rs +++ b/burn-core/src/nn/pool/avg_pool2d.rs @@ -20,7 +20,7 @@ pub struct AvgPool2dConfig { pub padding: PaddingConfig2d, /// If the padding is counted in the denominator when computin...
diff --git a/burn-import/onnx-tests/tests/avg_pool2d/avg_pool2d.py b/burn-import/onnx-tests/tests/avg_pool2d/avg_pool2d.py --- a/burn-import/onnx-tests/tests/avg_pool2d/avg_pool2d.py +++ b/burn-import/onnx-tests/tests/avg_pool2d/avg_pool2d.py @@ -10,14 +10,20 @@ class Model(nn.Module): def __init__(self): ...
Support for `count_include_pad=False` for AvgPool1d and AvgPool2d #### Description The current implementation of the `AvgPool2d` layer in the Burn framework assumes that `count_include_pad=True`, meaning that zero-padding is included in the average pooling calculation. While this approach is valid and useful in so...
I am reopening it to work on onnx part. I will take care of it. @antimora Yup I forgot it sorry ! @nathanielsimard I started working on ONNX changes but I may not be able to complete before a planned release. It appears a little more involved because PyTorch adds Pads node instead of accounting in AvgPool logic itself....
2023-11-21T00:53:50Z
0.2
2023-11-22T14:28:21Z
306619629797ad4bd631a60560c198e3113f25bf
[ "burn::node::avg_pool2d::tests::test_codegen" ]
[ "burn::node::base::tests::test_codegen_clone_tensor", "burn::node::binary::tests::test_binary_codegen_add_scalars", "burn::node::binary::tests::test_binary_codegen_div_scalars", "burn::node::binary::tests::test_binary_codegen_div", "burn::node::binary::tests::test_binary_codegen_sub", "burn::node::conv2d:...
[]
[]
auto_2025-06-10
tracel-ai/burn
2,186
tracel-ai__burn-2186
[ "2185" ]
c29ed43441fc5b3286749816c9069ed90f178a77
diff --git a/crates/burn-core/src/nn/norm/layer.rs b/crates/burn-core/src/nn/norm/layer.rs --- a/crates/burn-core/src/nn/norm/layer.rs +++ b/crates/burn-core/src/nn/norm/layer.rs @@ -67,7 +67,7 @@ impl<B: Backend> LayerNorm<B> { pub fn forward<const D: usize>(&self, input: Tensor<B, D>) -> Tensor<B, D> { ...
diff --git a/crates/burn-core/src/nn/norm/layer.rs b/crates/burn-core/src/nn/norm/layer.rs --- a/crates/burn-core/src/nn/norm/layer.rs +++ b/crates/burn-core/src/nn/norm/layer.rs @@ -122,6 +122,27 @@ mod tests { output.to_data().assert_approx_eq(&expected, 3); } + #[test] + fn layer_norm_forward_l...
LayerNorm does not normalize its input correctly **Describe the bug** Both from pytorch documentation...: https://pytorch.org/docs/stable/generated/torch.nn.LayerNorm.html#torch.nn.LayerNorm ``` y = (x − E[x]) / sqrt(Var[x] + ϵ)∗γ + β ``` ... and from pytorch ATen implementation...: https://github.com/pytorch/...
2024-08-20T07:32:27Z
0.14
2024-08-20T11:47:34Z
978ac6c4ecbb4e223c6f0f6361fae982f89e5fde
[ "nn::norm::layer::tests::layer_norm_forward_large_epsilon" ]
[ "lr_scheduler::cosine::test::config_initial_lr_too_high - should panic", "grad_clipping::base::tests::test_clip_by_value", "grad_clipping::base::tests::test_clip_by_norm", "lr_scheduler::cosine::test::config_initial_lr_too_low - should panic", "lr_scheduler::cosine::test::config_min_lr_too_low - should pani...
[]
[]
auto_2025-06-10
tokio-rs/axum
1,934
tokio-rs__axum-1934
[ "1931" ]
377d73a55ba7bdbb1a47084c684fb1334b200f1b
diff --git a/axum/CHANGELOG.md b/axum/CHANGELOG.md --- a/axum/CHANGELOG.md +++ b/axum/CHANGELOG.md @@ -7,7 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 # Unreleased -- None. +- **fixed:** Don't allow extracting `MatchedPath` in fallbacks ([#1934]) +- **fixed:** Fix pani...
diff --git a/axum/src/extract/matched_path.rs b/axum/src/extract/matched_path.rs --- a/axum/src/extract/matched_path.rs +++ b/axum/src/extract/matched_path.rs @@ -176,6 +176,7 @@ mod tests { Router, }; use http::{Request, StatusCode}; + use hyper::Body; #[crate::test] async fn extracti...
Axum 0.6.15 seems to break ServeDir completely - [x] I have looked for existing issues (including closed) about this ## Bug Report ### Version `cargo tree | grep axum` ``` axum v0.6.15 │ ├── axum-core v0.3.4 │ ├── axum-core v0.3.4 ``` `cargo tree | grep tower-http` ``` tower-http ├── tower-http v0...
Not sure if your actual routing setup is more complex than that but you don't need to crate a `Router` just to put `ServeDir` into a `fallback_service`. You simply do: ```rust let routes_all = Router::new().fallback_service(ServeDir::new("./")); ``` This works because `ServeDir` implements `Service` which is th...
2023-04-14T09:58:06Z
0.6
2023-04-17T11:20:56Z
c100650464e96cc9b48a37290760f288d6311ed8
[ "error_handling::traits", "body::stream_body::stream_body_traits", "extract::connect_info::traits", "extract::host::tests::forwarded_parsing", "extract::path::de::tests::test_parse_error_at_index_error", "extract::path::de::tests::test_parse_error_at_key_error", "extract::path::de::tests::test_parse_err...
[]
[]
[]
auto_2025-06-06
tokio-rs/axum
1,889
tokio-rs__axum-1889
[ "1884" ]
24f8dc53f49d8946418f103314ab6a31ff68be5c
diff --git a/axum-extra/CHANGELOG.md b/axum-extra/CHANGELOG.md --- a/axum-extra/CHANGELOG.md +++ b/axum-extra/CHANGELOG.md @@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning]. # Unreleased -- None. +- **added:** Add `OptionalPath` extractor ([#1889]) + +[#1889]: https://github.com/tokio-rs/axum/pull/...
diff --git /dev/null b/axum-extra/src/extract/optional_path.rs new file mode 100644 --- /dev/null +++ b/axum-extra/src/extract/optional_path.rs @@ -0,0 +1,102 @@ +use axum::{ + async_trait, + extract::{path::ErrorKind, rejection::PathRejection, FromRequestParts, Path}, + RequestPartsExt, +}; +use serde::de::De...
OptionalPath extractor - [x] I have looked for existing issues (including closed) about this ## Feature Request ### Motivation We've been getting many people asking about an easy way of extracting a path segment value only if a placeholder exists at the route the handler was called from. ### Proposal Add...
``` .route("/", get(handler) .route("/:path", get(handler)) ``` ```rs pub(crate) async fn handler( path: Option<Path<String>>, ) -> impl IntoResponse { .. } ``` Yes, that works most of the time, but it doesn't reject the request for `/:path` requests with invalid UTF-8. Or m...
2023-03-27T17:03:41Z
0.6
2023-04-09T12:23:15Z
c100650464e96cc9b48a37290760f288d6311ed8
[ "extract::cached::tests::works", "extract::cookie::tests::signed_cannot_access_invalid_cookies", "extract::cookie::tests::plaintext_cookies", "extract::with_rejection::tests::extractor_rejection_is_transformed", "extract::cookie::tests::private_cookies", "extract::cookie::tests::signed_cookies_with_custom...
[]
[]
[]
auto_2025-06-06
tokio-rs/axum
1,826
tokio-rs__axum-1826
[ "1738" ]
1327a598ce07c4642a2cca2c20f1093d7ff123f7
diff --git a/axum-macros/CHANGELOG.md b/axum-macros/CHANGELOG.md --- a/axum-macros/CHANGELOG.md +++ b/axum-macros/CHANGELOG.md @@ -7,7 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 # Unreleased -- None. +- **fixed:** Improve `#[debug_handler]` message for known generic +...
diff --git /dev/null b/axum-macros/tests/debug_handler/fail/json_not_deserialize.rs new file mode 100644 --- /dev/null +++ b/axum-macros/tests/debug_handler/fail/json_not_deserialize.rs @@ -0,0 +1,9 @@ +use axum::Json; +use axum_macros::debug_handler; + +struct Struct {} + +#[debug_handler] +async fn handler(foo: Json<...
`#[debug_handler]` could suggest `Deserialize` for `Json` - [x] I have looked for existing issues (including closed) about this ## Feature Request ### Motivation While trying to teach someone axum I suggested the use of the `#[debug_handler]` macro in order to find out why their handler wasn't working. The err...
Thats a regression I'm surprised we missed actually. Thought we had a test for that but oh well. On 0.5 the error is ``` error[E0277]: the trait bound `for<'de> NotDeserialize: serde::de::Deserialize<'de>` is not satisfied --> src/main.rs:19:21 | 19 | async fn handler(_: Json<NotDeserialize>) {} | ...
2023-03-07T13:14:46Z
0.6
2023-03-10T08:51:05Z
c100650464e96cc9b48a37290760f288d6311ed8
[ "debug_handler::ui" ]
[ "tests/typed_path/fail/missing_capture.rs [should fail to compile]", "tests/typed_path/fail/missing_field.rs [should fail to compile]", "tests/typed_path/fail/not_deserialize.rs [should fail to compile]", "tests/typed_path/fail/route_not_starting_with_slash.rs [should fail to compile]", "tests/typed_path/fa...
[]
[]
auto_2025-06-06
tokio-rs/axum
1,810
tokio-rs__axum-1810
[ "1781" ]
5606ea3f9ecb738c1cd4321fa0bedc4fc2adc29f
diff --git a/axum/CHANGELOG.md b/axum/CHANGELOG.md --- a/axum/CHANGELOG.md +++ b/axum/CHANGELOG.md @@ -9,11 +9,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - **fixed:** Add `#[must_use]` attributes to types that do nothing unless used ([#1809]) - **fixed:** Add `#[must_use]...
diff --git a/axum/src/typed_header.rs b/axum/src/typed_header.rs --- a/axum/src/typed_header.rs +++ b/axum/src/typed_header.rs @@ -175,19 +177,35 @@ mod tests { async fn typed_header() { async fn handle( TypedHeader(user_agent): TypedHeader<headers::UserAgent>, + TypedHeader(cookie...
TypedHeader shouldn't reject missing headers by default - [x] I have looked for existing issues (including closed) about this ## Feature Request TypedHeader should allow specific Header type to handle missing headers instead of immediately rejecting the request. ### Motivation `Header` trait already allows ...
Seems reasonable! axum just calls [`typed_try_get`](https://docs.rs/headers/0.3.8/src/headers/map_ext.rs.html#41). Could the issue be there? Seems like it, that optimization (?) of returning `Ok(None)` when the size hint is 0 seems wrong according to the original issue description. Traced it down through git blame to h...
2023-03-03T12:24:36Z
0.6
2023-03-03T15:13:25Z
c100650464e96cc9b48a37290760f288d6311ed8
[ "typed_header::tests::typed_header" ]
[ "error_handling::traits", "body::stream_body::stream_body_traits", "extract::connect_info::traits", "extract::host::tests::forwarded_parsing", "extract::path::de::tests::test_parse_error_at_key_error", "extract::path::de::tests::test_parse_error_at_index_error", "extract::path::de::tests::test_parse_err...
[]
[]
auto_2025-06-06
tokio-rs/axum
1,469
tokio-rs__axum-1469
[ "1467" ]
70833b9f4f8c528a88e7d97fe5193a37f4bf51e3
diff --git a/axum/src/middleware/from_extractor.rs b/axum/src/middleware/from_extractor.rs --- a/axum/src/middleware/from_extractor.rs +++ b/axum/src/middleware/from_extractor.rs @@ -201,7 +201,7 @@ where impl<T, E, B, S> Service<Request<B>> for FromExtractor<T, E, S> where E: FromRequestParts<S> + 'static, - ...
diff --git a/axum/src/middleware/from_extractor.rs b/axum/src/middleware/from_extractor.rs --- a/axum/src/middleware/from_extractor.rs +++ b/axum/src/middleware/from_extractor.rs @@ -305,9 +304,10 @@ where #[cfg(test)] mod tests { use super::*; - use crate::{handler::Handler, routing::get, test_helpers::*, Ro...
`from_extractor` not compatible with `RequestBodyLimitLayer` I tried adding the `RequestBodyLimitLayer` to my application. This works for everything, except the routes that contain a layer built with `from_extractor`. My `axum` version is `0.5.16`, `tower-http` is `0.3.4` and `rustc` is `1.63.0`. ## A minimized e...
2022-10-10T16:24:03Z
0.14
2022-10-11T11:11:51Z
beb5ebbe8abb5f7e9afec08ed86e878d6272375e
[ "body::stream_body::stream_body_traits", "error_handling::traits", "extract::connect_info::traits", "extract::host::tests::forwarded_parsing", "extract::path::de::tests::test_parse_error_error", "extract::path::de::tests::test_parse_error_at_index_error", "extract::path::de::tests::test_parse_error_at_k...
[]
[]
[]
auto_2025-06-06
tokio-rs/axum
1,305
tokio-rs__axum-1305
[ "1290" ]
fa51cf52664d2e33fe37ca4252879bb1c73e87e9
diff --git a/axum-macros/CHANGELOG.md b/axum-macros/CHANGELOG.md --- a/axum-macros/CHANGELOG.md +++ b/axum-macros/CHANGELOG.md @@ -14,10 +14,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 enum but instead generate `type Rejection = axum::response::Response`. Use the new `#[...
diff --git a/axum-macros/src/from_request.rs b/axum-macros/src/from_request.rs --- a/axum-macros/src/from_request.rs +++ b/axum-macros/src/from_request.rs @@ -537,29 +734,57 @@ fn impl_enum_by_extracting_all_at_once( let path_span = path.span(); - Ok(quote_spanned! {path_span=> - #[::axum::async_trai...
Add `#[derive(FromRequestParts)]` macro ## Feature Request ### Motivation I'm pretty sure many current users of the `FromRequest` macro are using the resulting type as a non-terminal extractor. After #1272, this will no longer be supported. ### Proposal Add `FromRequestParts` macro after #1272, but before t...
2022-08-23T12:12:37Z
0.5
2022-08-23T19:14:03Z
fa51cf52664d2e33fe37ca4252879bb1c73e87e9
[ "tests/typed_path/fail/missing_capture.rs [should fail to compile]", "tests/typed_path/fail/missing_field.rs [should fail to compile]", "tests/typed_path/fail/not_deserialize.rs [should fail to compile]", "tests/typed_path/fail/route_not_starting_with_slash.rs [should fail to compile]", "tests/typed_path/fa...
[]
[]
[]
auto_2025-06-06
tokio-rs/axum
3,059
tokio-rs__axum-3059
[ "3056" ]
6d30c579e04cce85a161dd72f8129ad96aed482d
diff --git a/axum/src/extract/connect_info.rs b/axum/src/extract/connect_info.rs --- a/axum/src/extract/connect_info.rs +++ b/axum/src/extract/connect_info.rs @@ -92,6 +92,17 @@ const _: () = { *stream.remote_addr() } } + + impl<'a, L, F> Connected<serve::IncomingStream<'a, serve::TapIo<L,...
diff --git a/axum/src/serve.rs b/axum/src/serve.rs --- a/axum/src/serve.rs +++ b/axum/src/serve.rs @@ -434,6 +434,7 @@ mod tests { extract::connect_info::Connected, handler::{Handler, HandlerWithoutStateExt}, routing::get, + serve::ListenerExt, Router, }; diff --git a/a...
into_make_service_with_connect_info not compile anymore <!-- Thank you for reporting an issue. Please fill in as much of the template below as you're able. --> after this PR https://github.com/tokio-rs/axum/pull/2941 with `tap_io` called on `listener`, `axum::serve(listener, app.into_make_service_with_co...
Thanks for the report! I will look into it soon.
2024-12-01T11:50:12Z
1.0
2024-12-02T07:36:52Z
6d30c579e04cce85a161dd72f8129ad96aed482d
[ "extract::connect_info::traits", "extract::connect_info::tests::custom", "error_handling::traits", "extract::matched_path::tests::can_extract_nested_matched_path_in_middleware_on_nested_router_with_nest_service", "extract::connect_info::tests::socket_addr", "extract::matched_path::tests::can_extract_neste...
[]
[]
[]
auto_2025-06-06
tokio-rs/axum
3,051
tokio-rs__axum-3051
[ "2651" ]
9ddb25f0897f7334e4e85ca26a81db272df1f02f
diff --git a/axum/src/routing/mod.rs b/axum/src/routing/mod.rs --- a/axum/src/routing/mod.rs +++ b/axum/src/routing/mod.rs @@ -200,6 +200,10 @@ where #[doc(alias = "scope")] // Some web frameworks like actix-web use this term #[track_caller] pub fn nest(self, path: &str, router: Router<S>) -> Self { + ...
diff --git a/axum/src/extract/matched_path.rs b/axum/src/extract/matched_path.rs --- a/axum/src/extract/matched_path.rs +++ b/axum/src/extract/matched_path.rs @@ -324,14 +324,14 @@ mod tests { "/{*path}", any(|req: Request| { Router::new() - .nest("/", Route...
Consider disallowing root nesting Before the 0.8.0 release, I would like to come back to `nest("/", router)` and `nest_service("/", svc)`. I believe I suggested disallowing them (in favor of `merge` and `fallback_service`) before, but if so there must have been some pushback by David since we still allow both. Any poi...
The only thing I found is this: https://github.com/tokio-rs/axum/discussions/2012 … which suggests I'm wrong about previous push-back and we should just disallow root nesting :) @jplatte are you planning to deprecate the `nest` function or just improve it? This is very handy and makes the code much readable. @dancixx ...
2024-11-26T18:29:20Z
1.0
2024-11-26T19:59:42Z
6d30c579e04cce85a161dd72f8129ad96aed482d
[ "routing::tests::nest::nest_router_at_empty_path - should panic", "routing::tests::nest::nest_service_at_empty_path - should panic", "routing::tests::nest::nest_service_at_root - should panic", "routing::tests::nest::nest_router_at_root - should panic" ]
[ "error_handling::traits", "extract::connect_info::traits", "extract::path::de::tests::test_deserialize_key_value", "extract::path::de::tests::test_parse_error_at_index_error", "extract::path::de::tests::test_parse_error_at_key_error", "extract::path::de::tests::test_parse_error_at_key_error_multiple", "...
[]
[]
auto_2025-06-06
tokio-rs/axum
3,039
tokio-rs__axum-3039
[ "3038" ]
7e59625778698410ff40ab968120cfea825a6d9a
diff --git a/axum/CHANGELOG.md b/axum/CHANGELOG.md --- a/axum/CHANGELOG.md +++ b/axum/CHANGELOG.md @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 # Unreleased - **fixed:** Skip SSE incompatible chars of `serde_json::RawValue` in `Event::json_data` ([#2992]) +- **fix...
diff --git a/axum/src/extract/path/mod.rs b/axum/src/extract/path/mod.rs --- a/axum/src/extract/path/mod.rs +++ b/axum/src/extract/path/mod.rs @@ -973,4 +973,25 @@ mod tests { r#"Invalid URL: Cannot parse `res` with value `456456-123-456456`: UUID parsing failed: invalid group count: expected 5, found 3"# ...
Hit unreachable code when deserializing a [char; 2] inside Path ### Description Hi, I used this struct inside a `Path` ``` #[derive(Debug, Deserialize)] struct MoreChars { first_two: [char; 2], second_two: [char; 2], crate_name: String, } ``` with the route `.route("/:first_two/:second_two/:cr...
Can reproduce on `main`.
2024-11-19T20:28:12Z
1.0
2024-11-19T20:57:31Z
6d30c579e04cce85a161dd72f8129ad96aed482d
[ "extract::path::tests::regression_3038" ]
[ "error_handling::traits", "extract::connect_info::tests::custom", "extract::connect_info::tests::both_mock_and_real_connect_info", "extract::connect_info::traits", "extract::connect_info::tests::socket_addr", "extract::matched_path::tests::can_extract_nested_matched_path_in_middleware_on_nested_router", ...
[]
[]
auto_2025-06-06
tokio-rs/axum
2,992
tokio-rs__axum-2992
[ "2981" ]
65ad603701c64db42bb759d35722cf7ee6864842
diff --git a/axum/CHANGELOG.md b/axum/CHANGELOG.md --- a/axum/CHANGELOG.md +++ b/axum/CHANGELOG.md @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 # Unreleased +- **fixed:** Skip SSE incompatible chars of `serde_json::RawValue` in `Event::json_data` ([#2992]) - **b...
diff --git a/axum/Cargo.toml b/axum/Cargo.toml --- a/axum/Cargo.toml +++ b/axum/Cargo.toml @@ -117,7 +117,7 @@ quickcheck = "1.0" quickcheck_macros = "1.0" reqwest = { version = "0.12", default-features = false, features = ["json", "stream", "multipart"] } serde = { version = "1.0", features = ["derive"] } -serde_js...
`Event::json_data` can construct an invalid SSE event by passing a `serde_json::value::RawValue` <!-- Thank you for reporting an issue. Please fill in as much of the template below as you're able. --> - [x] I have looked for existing issues (including closed) about this ## Bug Report When using `Event::js...
I don't really understand the second solution. The third one sounds reasonable to me. @SabrinaJewson do you have an opinion on this? Yeah, third solution sounds reasonable.
2024-10-16T17:35:52Z
1.0
2024-10-17T14:49:39Z
6d30c579e04cce85a161dd72f8129ad96aed482d
[ "response::sse::tests::valid_json_raw_value_chars_stripped" ]
[ "error_handling::traits", "extract::connect_info::traits", "extract::path::de::tests::test_parse_error_at_index_error", "extract::path::de::tests::test_parse_error_at_key_error", "extract::path::de::tests::test_parse_error_at_key_error_multiple", "extract::path::de::tests::test_parse_error_error", "extr...
[]
[]
auto_2025-06-06
tokio-rs/axum
2,903
tokio-rs__axum-2903
[ "2251" ]
0712a46cd9f2bece74160e83085411aa0c174be1
diff --git /dev/null b/axum/src/docs/routing/method_not_allowed_fallback.md new file mode 100644 --- /dev/null +++ b/axum/src/docs/routing/method_not_allowed_fallback.md @@ -0,0 +1,38 @@ +Add a fallback [`Handler`] for the case where a route exists, but the method of the request is not supported. + +Sets a fallback on ...
diff --git a/axum/src/routing/tests/fallback.rs b/axum/src/routing/tests/fallback.rs --- a/axum/src/routing/tests/fallback.rs +++ b/axum/src/routing/tests/fallback.rs @@ -329,6 +329,51 @@ async fn merge_router_with_fallback_into_empty() { assert_eq!(res.text().await, "outer"); } +#[crate::test] +async fn mna_fa...
Add a method-not-allowed fallback on the Router level - [x] I have looked for existing issues (including closed) about this ## Feature Request ### Motivation It's a common mistake to expect `Router::fallback` to be triggered on method-not-allowed. Furthermore, as shown by [#1005](https://github.com/tokio-rs/a...
I wonder if we should just apply the normal `Router::fallback` to both 404 and 405 (keeping the `Allow` header of course). Do you think that would work for most cases? Is it often that you want different fallbacks for 404 and 405? Wdym by keeping the allow header? You mean setting it if the user-provided fallback handl...
2024-09-08T18:55:33Z
1.0
2024-10-12T09:36:57Z
6d30c579e04cce85a161dd72f8129ad96aed482d
[ "error_handling::traits", "extract::connect_info::traits", "extract::host::tests::forwarded_parsing", "extract::path::de::tests::test_parse_error_at_key_error", "extract::path::de::tests::test_parse_error_at_index_error", "extract::path::de::tests::test_parse_error_error", "extract::path::de::tests::tes...
[]
[]
[]
auto_2025-06-06
tokio-rs/axum
868
tokio-rs__axum-868
[ "865" ]
422a883cb2a81fa6fbd2f2a1affa089304b7e47b
diff --git a/axum/CHANGELOG.md b/axum/CHANGELOG.md --- a/axum/CHANGELOG.md +++ b/axum/CHANGELOG.md @@ -71,6 +71,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 be accepted but most likely result in bugs ([#823]) - **breaking:** `Headers` has been removed. Arrays of tuples dire...
diff --git a/axum/src/json.rs b/axum/src/json.rs --- a/axum/src/json.rs +++ b/axum/src/json.rs @@ -244,4 +264,19 @@ mod tests { assert!(valid_json_content_type("application/cloudevents+json").await); assert!(!valid_json_content_type("text/json").await); } + + #[tokio::test] + async fn inval...
HTTP Status on Invalid JSON Request When I send a request where the `content-type` is not `application/json` I get the answer `415 Unsupported Media Type` and if the JSON parsing fails I get `422 Unprocessable Entity` Two issues: 1. This is not documented correctly: https://docs.rs/axum/latest/axum/struct.Json.ht...
👍🏼 for distinguishing syntactic errors and content errors. `serde_json::Error` has a `classify()` method that allows to check what failed exactly. > This is not documented correctly: https://docs.rs/axum/latest/axum/struct.Json.html In this documentation both of them would result in 400 Bad Request Good catch. Tha...
2022-03-17T17:15:56Z
0.4
2022-03-18T15:53:41Z
2e5d56a9b125142817378883b098470d05ab0597
[ "json::tests::invalid_json_syntax" ]
[ "error_handling::traits", "body::stream_body::stream_body_traits", "extract::path::de::tests::test_unsupported_type_error_tuple", "extract::path::de::tests::test_parse_tuple_ignoring_additional_fields", "extract::multipart::tests::content_type_with_encoding", "extract::path::de::tests::test_wrong_number_o...
[]
[]
auto_2025-06-06
tokio-rs/axum
755
tokio-rs__axum-755
[ "747" ]
409a6651f59c4443e7cd6aa05c6f9485348ceed9
diff --git a/axum/CHANGELOG.md b/axum/CHANGELOG.md --- a/axum/CHANGELOG.md +++ b/axum/CHANGELOG.md @@ -54,6 +54,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - **fixed:** Set `Allow` header when responding with `405 Method Not Allowed` ([#733]) - **fixed:** Correctly set the `C...
diff --git a/axum/src/routing/tests/mod.rs b/axum/src/routing/tests/mod.rs --- a/axum/src/routing/tests/mod.rs +++ b/axum/src/routing/tests/mod.rs @@ -645,3 +645,36 @@ async fn head_content_length_through_hyper_server_that_hits_fallback() { let res = client.head("/").send().await; assert_eq!(res.headers()["co...
Incorrect `content-length` header in reply to HEAD request when chunked transfer enconding is used ## Bug Report This is a followup to #730. Unfortunately, I found a case in which it still does not work correctly. ### Version axum main branch, commit 16ee83a ### Platform Debian Linux 12 (“bookworm”) Lin...
2022-02-12T16:28:48Z
0.4
2022-02-14T09:56:09Z
2e5d56a9b125142817378883b098470d05ab0597
[ "routing::tests::head_with_middleware_applied" ]
[ "body::stream_body::stream_body_traits", "error_handling::traits", "extract::connect_info::traits", "extract::extractor_middleware::traits", "extract::path::de::tests::test_parse_error_at_key_error", "extract::path::de::tests::test_parse_error_at_index_error", "extract::form::tests::test_form_query", ...
[]
[]
auto_2025-06-06
tokio-rs/axum
682
tokio-rs__axum-682
[ "681" ]
5512ebcd23d261a2be5ee07676721b7637ffc054
diff --git a/axum/CHANGELOG.md b/axum/CHANGELOG.md --- a/axum/CHANGELOG.md +++ b/axum/CHANGELOG.md @@ -9,8 +9,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - **fixed:** Fix using incorrect path prefix when nesting `Router`s at `/` ([#691]) - **fixed:** Make `nest("", service...
diff --git a/axum/src/routing/tests/mod.rs b/axum/src/routing/tests/mod.rs --- a/axum/src/routing/tests/mod.rs +++ b/axum/src/routing/tests/mod.rs @@ -354,6 +354,30 @@ async fn with_and_without_trailing_slash() { assert_eq!(res.text().await, "without tsr"); } +// for https://github.com/tokio-rs/axum/issues/681 ...
Use HTTP 308 instead of 301 for trailing slash redirects ## Feature Request ### Motivation Performing a POST to `/some/url/` (with the trailing slash) does an HTTP 301 (introduced in #410) to `/some/url`. However, HTTP 301 transforms a POST to a GET, which is undesired. ### Proposal Use [HTTP 308](https://d...
2022-01-01T02:57:12Z
0.4
2022-01-12T14:58:13Z
2e5d56a9b125142817378883b098470d05ab0597
[ "routing::tests::with_trailing_slash_post", "routing::tests::without_trailing_slash_post", "routing::tests::wildcard_with_trailing_slash" ]
[ "error_handling::traits", "body::stream_body::stream_body_traits", "extract::connect_info::traits", "extract::extractor_middleware::traits", "extract::path::de::tests::test_parse_error_at_key_error", "extract::path::de::tests::test_unsupported_type_error_nested_data_structure", "extract::path::de::tests...
[]
[]
auto_2025-06-06
tokio-rs/axum
644
tokio-rs__axum-644
[ "637" ]
4df4e07e10b13d05413c1da1a56d8f56ddbfb6ab
diff --git a/axum-core/CHANGELOG.md b/axum-core/CHANGELOG.md --- a/axum-core/CHANGELOG.md +++ b/axum-core/CHANGELOG.md @@ -7,7 +7,36 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 # Unreleased -- None. +- **breaking:** Using `HeaderMap` as an extractor will no longer remove the...
diff --git a/axum-core/src/extract/request_parts.rs b/axum-core/src/extract/request_parts.rs --- a/axum-core/src/extract/request_parts.rs +++ b/axum-core/src/extract/request_parts.rs @@ -76,27 +65,20 @@ where } } +/// Clone the headers from the request. +/// +/// Prefer using [`TypedHeader`] to extract only the...
Change return type of `Field::content_type` It should return some kind of string, or a type axum owns, to avoid the public dependency on mime. `Mime` implements `AsRef<str>` meaning we can probably return `&str` but should verify that it returns the whole mime type and not just a part.
Why do you prefer a string over `mime`'s enum types? Personally I like being able to `match` on valid mime types. It looks like [`mime` has been unmaintained for a while](https://github.com/hyperium/mime/issues/135) (and will likely continue to be). I'm not sure what a good alternative is though. [`http-types` has m...
2021-12-21T09:47:37Z
0.4
2022-06-11T11:06:23Z
2e5d56a9b125142817378883b098470d05ab0597
[ "response::headers::tests::with_body", "body::test_try_downcast", "response::headers::tests::with_status_and_body", "response::headers::tests::vec_of_strings", "response::headers::tests::vec_of_header_name_and_value", "response::headers::tests::invalid_header_name", "response::headers::tests::invalid_he...
[]
[]
[]
auto_2025-06-06
tokio-rs/axum
588
tokio-rs__axum-588
[ "587" ]
628921bcad878ab4396705e0798494fbc9ebd3c5
diff --git a/axum-debug/CHANGELOG.md b/axum-debug/CHANGELOG.md --- a/axum-debug/CHANGELOG.md +++ b/axum-debug/CHANGELOG.md @@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 # Unreleased -- None. +- Fix `Result<impl IntoResponse, Error>` generating invalid code ([#588]...
diff --git /dev/null b/axum-debug/tests/pass/result_impl_into_response.rs new file mode 100644 --- /dev/null +++ b/axum-debug/tests/pass/result_impl_into_response.rs @@ -0,0 +1,132 @@ +use axum::{ + async_trait, + extract::{FromRequest, RequestParts}, + response::IntoResponse, +}; +use axum_debug::debug_handle...
`#[debug_handler]` doesn't work with `Result<impl IntoResponse, SomeError>` This produces code that doesn't compile ```rust #[debug_handler] async fn handler() -> Result<impl IntoResponse, Infallible> { Ok(()) } ``` Error is: ``` error[E0720]: cannot resolve opaque type --> examples/hello-world/sr...
2021-12-04T14:46:46Z
0.4
2021-12-04T17:54:11Z
2e5d56a9b125142817378883b098470d05ab0597
[ "tests/pass/result_impl_into_response.rs [should pass]", "tests/pass/self_receiver.rs [should pass]", "ui" ]
[ "tests/fail/argument_not_extractor.rs [should fail to compile]", "tests/fail/attrs.rs [should fail to compile]", "tests/fail/extract_self_mut.rs [should fail to compile]", "tests/fail/extract_self_ref.rs [should fail to compile]", "tests/fail/generics.rs [should fail to compile]", "tests/fail/not_a_functi...
[]
[]
auto_2025-06-06
tokio-rs/axum
533
tokio-rs__axum-533
[ "528" ]
939995e80edaf4e882a6e2decb07db5a7c0a2c06
diff --git a/axum-handle-error-extract/src/lib.rs b/axum-handle-error-extract/src/lib.rs --- a/axum-handle-error-extract/src/lib.rs +++ b/axum-handle-error-extract/src/lib.rs @@ -281,8 +281,8 @@ where let future = Box::pin(async move { match inner.oneshot(req).await { - Ok(res) =>...
diff --git a/axum-handle-error-extract/src/lib.rs b/axum-handle-error-extract/src/lib.rs --- a/axum-handle-error-extract/src/lib.rs +++ b/axum-handle-error-extract/src/lib.rs @@ -138,7 +138,7 @@ #![cfg_attr(test, allow(clippy::float_cmp))] use axum::{ - body::{box_body, BoxBody, Bytes, Full, HttpBody}, + body...
Rename `box_body` to `boxed` As its consistent with `http_body::Body::boxed`. Will be deprecated in 0.3.4 and removed in 0.4
2021-11-17T12:44:21Z
0.3
2021-11-17T12:59:30Z
939995e80edaf4e882a6e2decb07db5a7c0a2c06
[ "src/lib.rs - (line 7)", "src/lib.rs - (line 54)", "body::stream_body::stream_body_traits", "error_handling::traits", "extract::connect_info::traits", "extract::extractor_middleware::traits", "extract::path::de::tests::test_parse_struct", "extract::form::tests::test_form_query", "extract::path::de::...
[]
[]
[]
auto_2025-06-06
tokio-rs/axum
530
tokio-rs__axum-530
[ "528" ]
b9dfea636071c2c194c8251612beba9d0515e9fe
diff --git a/axum-handle-error-extract/src/lib.rs b/axum-handle-error-extract/src/lib.rs --- a/axum-handle-error-extract/src/lib.rs +++ b/axum-handle-error-extract/src/lib.rs @@ -281,8 +281,8 @@ where let future = Box::pin(async move { match inner.oneshot(req).await { - Ok(res) =>...
diff --git a/axum-handle-error-extract/src/lib.rs b/axum-handle-error-extract/src/lib.rs --- a/axum-handle-error-extract/src/lib.rs +++ b/axum-handle-error-extract/src/lib.rs @@ -138,7 +138,7 @@ #![cfg_attr(test, allow(clippy::float_cmp))] use axum::{ - body::{box_body, BoxBody, Bytes, Full, HttpBody}, + body...
Rename `box_body` to `boxed` As its consistent with `http_body::Body::boxed`. Will be deprecated in 0.3.4 and removed in 0.4
2021-11-17T08:54:59Z
0.3
2021-11-17T12:31:11Z
939995e80edaf4e882a6e2decb07db5a7c0a2c06
[ "src/lib.rs - (line 54)", "src/lib.rs - (line 7)", "body::stream_body::stream_body_traits", "error_handling::traits", "extract::connect_info::traits", "extract::extractor_middleware::traits", "extract::path::de::tests::test_parse_map", "extract::path::de::tests::test_parse_single_value", "extract::f...
[]
[]
[]
auto_2025-06-06
tokio-rs/axum
529
tokio-rs__axum-529
[ "488" ]
f9a437d0813c0e2f784ca90eccccb4fbad9126cb
diff --git a/axum/CHANGELOG.md b/axum/CHANGELOG.md --- a/axum/CHANGELOG.md +++ b/axum/CHANGELOG.md @@ -28,10 +28,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - **breaking:** The `Handler<B, T>` trait is now defined as `Handler<T, B = Body>`. That is the type parameters have...
diff --git a/axum/src/routing/tests/fallback.rs b/axum/src/routing/tests/fallback.rs --- a/axum/src/routing/tests/fallback.rs +++ b/axum/src/routing/tests/fallback.rs @@ -49,25 +49,3 @@ async fn or() { assert_eq!(res.status(), StatusCode::OK); assert_eq!(res.text().await, "fallback"); } - -#[tokio::test] -as...
Panic if merging two routers that each have a fallback Currently when you `Router::merge` two routes that each have a fallback it'll pick the fallback of the router on the right hand side, and if only one has a fallback it'll pick that one. This might lead users to think that multiple fallbacks are supported (see https...
👍 for panicking. Silently discarding a fallback service will almost definitely end up causing issue for someone.
2021-11-16T22:44:32Z
0.3
2021-11-18T21:19:07Z
939995e80edaf4e882a6e2decb07db5a7c0a2c06
[ "routing::tests::merging_routers_with_fallbacks_panics - should panic", "routing::tests::nesting_router_with_fallbacks_panics - should panic" ]
[ "error_handling::traits", "body::stream_body::stream_body_traits", "extract::connect_info::traits", "extract::extractor_middleware::traits", "extract::path::de::tests::test_parse_struct", "extract::form::tests::test_form_query", "extract::path::de::tests::test_parse_map", "extract::form::tests::test_i...
[]
[]
auto_2025-06-06
tokio-rs/axum
423
tokio-rs__axum-423
[ "419" ]
8fe4eaf1d5a17fc1919afc64f7c2e8c890069653
diff --git a/src/routing/mod.rs b/src/routing/mod.rs --- a/src/routing/mod.rs +++ b/src/routing/mod.rs @@ -440,8 +440,7 @@ where LayeredResBody::Error: Into<BoxError>, { let layer = ServiceBuilder::new() - .layer_fn(Route) - .layer_fn(CloneBoxService::new) + .laye...
diff --git a/src/tests/mod.rs b/src/tests/mod.rs --- a/src/tests/mod.rs +++ b/src/tests/mod.rs @@ -684,8 +684,6 @@ async fn middleware_still_run_for_unmatched_requests() { assert_eq!(COUNT.load(Ordering::SeqCst), 2); } -// TODO(david): middleware still run for empty routers - pub(crate) fn assert_send<T: Send>...
First parameterized path component stripped from logs ## Bug Report <!-- Thank you for reporting an issue. Please fill in as much of the template below as you're able. --> ### Version <!-- List the versions of all `axum` crates you are using. The easiest way to get this information is using `cargo tre...
2021-10-26T17:06:24Z
0.3
2021-10-26T17:30:00Z
939995e80edaf4e882a6e2decb07db5a7c0a2c06
[ "tests::nest::outer_middleware_still_see_whole_url" ]
[ "error_handling::traits", "body::stream_body::stream_body_traits", "extract::extractor_middleware::traits", "extract::connect_info::traits", "extract::path::de::tests::test_parse_struct", "extract::path::de::tests::test_parse_map", "extract::path::de::tests::test_parse_single_value", "extract::form::t...
[]
[]
auto_2025-06-06
tokio-rs/axum
412
tokio-rs__axum-412
[ "386" ]
e43bdf0ecf3ad8a8de7694658f73143e1ca066fc
diff --git a/CHANGELOG.md b/CHANGELOG.md --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -136,6 +136,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 without trailing a slash. - **breaking:** `EmptyRouter` has been renamed to `MethodNotAllowed` as its only used in method routers...
diff --git a/src/tests/mod.rs b/src/tests/mod.rs --- a/src/tests/mod.rs +++ b/src/tests/mod.rs @@ -1,6 +1,7 @@ #![allow(clippy::blacklisted_name)] use crate::error_handling::HandleErrorLayer; +use crate::extract::MatchedPath; use crate::BoxError; use crate::{ extract::{self, Path}, diff --git a/src/tests/mod...
Allow access to matched route pattern(s) from middlewares ## Feature Request As far as I can tell it's not possible to access information about if a route matched and if so, which route pattern (or patterns in case of nested routes) was matched. This is something a lot of services in environments I've worked needs. ...
Actually I'm not sure its possible to fix. Any middleware you apply run before the router sees the request. So if the router added the matched pattern to a request extension middleware wouldn't see the extension because they run _before_ the router. You'd only be able to see the extension in handlers but that seems les...
2021-10-25T21:34:02Z
0.3
2021-10-25T21:38:30Z
939995e80edaf4e882a6e2decb07db5a7c0a2c06
[ "body::stream_body::stream_body_traits", "error_handling::traits", "extract::connect_info::traits", "extract::extractor_middleware::traits", "extract::path::de::tests::test_parse_struct", "extract::form::tests::test_form_query", "extract::path::de::tests::test_parse_map", "extract::form::tests::test_i...
[]
[]
[]
auto_2025-06-06
tokio-rs/axum
1,189
tokio-rs__axum-1189
[ "1175" ]
7e7a2f2058690e8286187c1bd7ac999dcfa506b6
diff --git /dev/null b/examples/handle-head-request/Cargo.toml new file mode 100644 --- /dev/null +++ b/examples/handle-head-request/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "example-handle-head-request" +version = "0.1.0" +edition = "2021" +publish = false + +[dependencies] +axum = { path = "../../axum" } +tokio...
diff --git /dev/null b/examples/handle-head-request/src/main.rs new file mode 100644 --- /dev/null +++ b/examples/handle-head-request/src/main.rs @@ -0,0 +1,82 @@ +//! Run with +//! +//! ```not_rust +//! cd examples && cargo run -p example-handle-head-request +//! ``` + +use axum::response::{IntoResponse, Response}; +u...
Add an example for a GET-or-HEAD handler that special-cases HEAD Registering a `GET` route also registers a `HEAD` route that calls the same handler. axum will strip the response body if this handler is called with `HEAD`, but that is potentially much slower than never generating a response body in the first place. We ...
I'd be happy to tackle this one as well, though I understand if you want to reserve an issue for the upcoming TWiR and new contributors. Maybe we wait a few days and if nobody else shows interest you do it? Hi, @jplatte I found this from TWIR. I am interested in contributing, let me grab this. Thanks.
2022-07-23T11:10:28Z
0.5
2022-07-27T15:41:40Z
fa51cf52664d2e33fe37ca4252879bb1c73e87e9
[ "tests::test_something", "tests::not_found", "tests::hello_world", "tests::json", "tests::multiple_request", "tests::the_real_deal" ]
[]
[]
[]
auto_2025-06-06
tokio-rs/axum
957
tokio-rs__axum-957
[ "954" ]
8084b242d5b78e53267e63c693dadf71e313320c
diff --git a/axum/CHANGELOG.md b/axum/CHANGELOG.md --- a/axum/CHANGELOG.md +++ b/axum/CHANGELOG.md @@ -9,8 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - **added:** Add `response::ErrorResponse` and `response::Result` for `IntoResponse`-based error handling ([#921]) +-...
diff --git a/axum/src/extract/extractor_middleware.rs b/axum/src/extract/extractor_middleware.rs --- a/axum/src/extract/extractor_middleware.rs +++ b/axum/src/extract/extractor_middleware.rs @@ -2,324 +2,15 @@ //! //! See [`extractor_middleware`] for more details. -use super::{FromRequest, RequestParts}; -use crate...
Move `axum::extract::extractor_middleware` to `axum::middleware::from_extractor` ## Feature Request ### Motivation <!-- Please describe the use case(s) or other motivation for the new feature. --> ### Proposal <!-- How should the new feature be implemented, and why? Add any considered drawbacks. --> ...
Sounds good to me! We didn't use to have the middleware module but that is probably a better home for it. You up for making a PR? We just have to make its not a breaking change by re-exporting it from the old location. Also, next time please fill in the issue template. Thats what its there for. If we want to depr...
2022-04-22T14:54:04Z
0.5
2022-04-24T15:31:17Z
fa51cf52664d2e33fe37ca4252879bb1c73e87e9
[ "body::stream_body::stream_body_traits", "error_handling::traits", "extract::connect_info::traits", "extract::path::de::tests::test_parse_error_at_index_error", "extract::form::tests::test_form_query", "extract::form::tests::test_incorrect_content_type", "extract::path::de::tests::test_parse_error_at_ke...
[]
[]
[]
auto_2025-06-06
tokio-rs/axum
892
tokio-rs__axum-892
[ "859" ]
2e5d56a9b125142817378883b098470d05ab0597
diff --git a/axum/CHANGELOG.md b/axum/CHANGELOG.md --- a/axum/CHANGELOG.md +++ b/axum/CHANGELOG.md @@ -88,6 +88,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - **changed:** Update to tokio-tungstenite 0.17 ([#791]) - **breaking:** `Redirect::{to, temporary, permanent}` now acce...
diff --git a/axum/src/extract/connect_info.rs b/axum/src/extract/connect_info.rs --- a/axum/src/extract/connect_info.rs +++ b/axum/src/extract/connect_info.rs @@ -161,7 +161,7 @@ mod tests { let app = Router::new().route("/", get(handler)); let server = Server::from_tcp(listener) ...
`Router::into_make_service_with_connect_info()` has unnecessary `Target` parameter that can fail to be inferred ## Bug Report ### Version axum 0.4.8 ### Crates axum ### Description [`Router::into_make_service_with_connect_info()`](https://docs.rs/axum/0.4.8/axum/struct.Router.html#method.into_make_ser...
> As soon as you have one C that implements Connected for multiple targets, that parameter needs to be specified explicitly. This is very annoying. What is your use case for this? > It probably does produce a better error message when the wrong type is used, but having to write out the connection type is frustrat...
2022-03-31T16:37:01Z
0.4
2022-03-31T16:49:50Z
2e5d56a9b125142817378883b098470d05ab0597
[ "error_handling::traits", "body::stream_body::stream_body_traits", "extract::connect_info::traits", "extract::extractor_middleware::traits", "extract::form::tests::test_form_query", "extract::form::tests::test_form_body", "extract::form::tests::test_incorrect_content_type", "extract::path::de::tests::...
[]
[]
[]
auto_2025-06-06
tokio-rs/axum
2,881
tokio-rs__axum-2881
[ "2879" ]
bd3eaa78866127bb9106972f55190cf9fcf3305c
diff --git a/axum/CHANGELOG.md b/axum/CHANGELOG.md --- a/axum/CHANGELOG.md +++ b/axum/CHANGELOG.md @@ -11,10 +11,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - **added:** `axum::serve::Serve::tcp_nodelay` and `axum::serve::WithGracefulShutdown::tcp_nodelay` ([#2653]) - **adde...
diff --git a/axum/src/serve.rs b/axum/src/serve.rs --- a/axum/src/serve.rs +++ b/axum/src/serve.rs @@ -544,6 +554,10 @@ mod tests { routing::get, Router, }; + use std::{ + future::pending, + net::{IpAddr, Ipv4Addr}, + }; #[allow(dead_code, unused_must_use)] async f...
add means to find the socket address for Serve and WithGracefulShutdown - [*] I have looked for existing issues (including closed) about this ## Feature Request I would like to get the socket address of `Serve` and `WithGracefulShutdown`. ### Motivation I am the maintainer of Axum Test, and the initial moti...
2024-08-18T13:32:04Z
0.7
2024-08-25T09:16:13Z
4179d11797bd8880c74a306b7e05e9d0f081ca1d
[ "error_handling::traits", "extract::connect_info::traits", "extract::host::tests::forwarded_parsing", "extract::path::de::tests::test_parse_error_at_index_error", "extract::path::de::tests::test_parse_error_at_key_error", "extract::path::de::tests::test_parse_error_error", "extract::path::de::tests::tes...
[]
[]
[]
auto_2025-06-06
tokio-rs/axum
2,645
tokio-rs__axum-2645
[ "2641" ]
5db62e8452f3c34bab83f3fdfacffa1946b91af1
diff --git a/axum-extra/src/extract/optional_path.rs b/axum-extra/src/extract/optional_path.rs --- a/axum-extra/src/extract/optional_path.rs +++ b/axum-extra/src/extract/optional_path.rs @@ -28,7 +28,7 @@ use serde::de::DeserializeOwned; /// /// let app = Router::new() /// .route("/blog", get(render_blog)) -/// ...
diff --git a/axum-extra/src/extract/optional_path.rs b/axum-extra/src/extract/optional_path.rs --- a/axum-extra/src/extract/optional_path.rs +++ b/axum-extra/src/extract/optional_path.rs @@ -75,7 +75,7 @@ mod tests { let app = Router::new() .route("/", get(handle)) - .route("/:num", g...
Update `matchit` to 0.8 - [x] I have looked for existing issues (including closed) about this ### Proposal `matchit` version 0.8 was just [released](https://github.com/ibraheemdev/matchit/releases/tag/v0.8.0). It includes changes to the syntax so now instead of `/path/:arg/*wildcard` it uses `/path/{arg}/{*wil...
2024-03-12T23:28:55Z
0.7
2024-10-10T20:46:34Z
4179d11797bd8880c74a306b7e05e9d0f081ca1d
[ "tests/typed_path/pass/customize_rejection.rs [should pass]", "tests/typed_path/pass/into_uri.rs [should pass]", "tests/typed_path/pass/named_fields_struct.rs [should pass]", "tests/typed_path/pass/option_result.rs [should pass]", "tests/typed_path/pass/tuple_struct.rs [should pass]", "tests/typed_path/pa...
[ "tests/debug_middleware/fail/doesnt_take_next.rs [should fail to compile]", "tests/debug_middleware/fail/next_not_last.rs [should fail to compile]", "tests/debug_middleware/fail/takes_next_twice.rs [should fail to compile]", "tests/debug_middleware/pass/basic.rs [should pass]", "debug_handler::ui_debug_midd...
[]
[]
auto_2025-06-06