From 49f6e70a19cd6a49692ef918cfbd3f6ec465ad48 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Tue, 31 Oct 2023 21:04:46 -0400 Subject: [PATCH] Use RPIT to get static dispatch GetStandardProperties. --- src/types/get_standard_properties.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/types/get_standard_properties.rs b/src/types/get_standard_properties.rs index ae6464bd..9ffe0fb7 100644 --- a/src/types/get_standard_properties.rs +++ b/src/types/get_standard_properties.rs @@ -10,3 +10,14 @@ impl<'s, I: StandardProperties<'s>> GetStandardProperties<'s> for I { self } } + +pub trait NewGetStandardProperties<'s> { + // TODO: Can I eliminate this dynamic dispatch, perhaps using nominal generic structs? Low prioritiy since this is not used during parsing. + fn get_standard_properties(self) -> impl StandardProperties<'s>; +} + +impl<'s, I: StandardProperties<'s>> NewGetStandardProperties<'s> for I { + fn get_standard_properties(self) -> impl StandardProperties<'s> { + self + } +}