From 48c6cd327d3c1df4218898be509250efcc56597c Mon Sep 17 00:00:00 2001 From: PizzasBear <43722034+PizzasBear@users.noreply.github.com> Date: Wed, 22 Nov 2023 15:56:14 +0200 Subject: Enhance match to include multiple targets (#911) Signed-off-by: max --- askama_derive/src/generator.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'askama_derive') diff --git a/askama_derive/src/generator.rs b/askama_derive/src/generator.rs index 8f0b7b3..c6c5d10 100644 --- a/askama_derive/src/generator.rs +++ b/askama_derive/src/generator.rs @@ -1579,6 +1579,16 @@ impl<'a> Generator<'a> { } buf.write(name); } + Target::OrChain(targets) => match targets.first() { + None => buf.write("_"), + Some(first_target) => { + self.visit_target(buf, initialized, first_level, first_target); + for target in &targets[1..] { + buf.write(" | "); + self.visit_target(buf, initialized, first_level, target); + } + } + }, Target::Tuple(path, targets) => { buf.write(&path.join("::")); buf.write("("); -- cgit