From a4de3cf79a9cce3065512d79f933a22b71e837f2 Mon Sep 17 00:00:00 2001 From: Paris DOUADY Date: Tue, 16 Jan 2024 16:14:08 +0100 Subject: [PATCH] sprinkle inlines --- prototypes/src/lib.rs | 3 +++ prototypes/src/macros.rs | 2 ++ 2 files changed, 5 insertions(+) diff --git a/prototypes/src/lib.rs b/prototypes/src/lib.rs index ede0cb8e..139f08d2 100644 --- a/prototypes/src/lib.rs +++ b/prototypes/src/lib.rs @@ -117,6 +117,7 @@ where } } +#[inline] pub fn try_prototype(id: ID) -> Option<&'static ::Prototype> where ID::Prototype: ConcretePrototype, @@ -124,12 +125,14 @@ where ::Prototype::storage(try_prototypes()?).get(&id) } +#[inline] pub fn prototypes_iter() -> impl Iterator { let p = prototypes(); let storage = T::storage(p); T::ordering(p).iter().map(move |id| &storage[id]) } +#[inline] pub fn prototypes_iter_ids() -> impl Iterator { T::ordering(prototypes()).iter().copied() } diff --git a/prototypes/src/macros.rs b/prototypes/src/macros.rs index 4390d61d..1d840c05 100644 --- a/prototypes/src/macros.rs +++ b/prototypes/src/macros.rs @@ -62,9 +62,11 @@ macro_rules! gen_prototypes { } impl $t { + #[inline] pub fn iter() -> impl Iterator { $crate::prototypes_iter::() } + #[inline] pub fn iter_ids() -> impl Iterator { $crate::prototypes_iter_ids::() }