Skip to content

Commit 4454de1

Browse files
committed
inline label methods
1 parent bde9c3d commit 4454de1

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

benches/benches/bevy_ecs/scheduling/schedule.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ pub fn build_schedule(criterion: &mut Criterion) {
6969
struct DummyLabel;
7070

7171
impl SystemLabel for NumLabel {
72+
#[inline]
7273
fn data(&self) -> u16 {
7374
self.0
7475
}

crates/bevy_macro_utils/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ pub fn derive_label(
228228

229229
(quote! {
230230
impl #impl_generics #trait_path for #ident #ty_generics #where_clause {
231+
#[inline]
231232
fn data(&self) -> u16 {
232233
#data
233234
}

crates/bevy_utils/src/label.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,16 @@ impl<'a> StuffedStr<'a> {
101101
}
102102
}
103103

104+
#[inline]
104105
fn len(&self) -> usize {
105106
self.meta >> 16
106107
}
108+
#[inline]
107109
pub fn data(&self) -> u16 {
108110
let data = self.meta & Self::DATA_MASK;
109111
data as u16
110112
}
113+
#[inline]
111114
pub fn as_str(&self) -> &'a str {
112115
// SAFETY: this instance was constructed from a string slice of length `len`, and lifetime `'a`.
113116
// It is sound to convert it back to a slice.
@@ -161,6 +164,7 @@ macro_rules! define_label {
161164
$id_name(ty, stuffed)
162165
}
163166
/// Returns the [`TypeId`] used to differentiate labels.
167+
#[inline]
164168
fn type_id(&self) -> ::core::any::TypeId {
165169
::core::any::TypeId::of::<Self>()
166170
}
@@ -174,12 +178,15 @@ macro_rules! define_label {
174178
}
175179

176180
impl $label_name for $id_name {
181+
#[inline]
177182
fn as_label(&self) -> Self {
178183
*self
179184
}
185+
#[inline]
180186
fn type_id(&self) -> ::core::any::TypeId {
181187
self.0
182188
}
189+
#[inline]
183190
fn data(&self) -> u16 {
184191
self.1.data()
185192
}

0 commit comments

Comments
 (0)