Skip to content

Commit 9afa762

Browse files
committed
inline label methods
1 parent 09cfe1f commit 9afa762

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

benches/benches/bevy_ecs/scheduling/schedule.rs

+1
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

+1
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

+7
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,16 @@ impl<'a> StuffedStr<'a> {
9191
}
9292
}
9393

94+
#[inline]
9495
fn len(&self) -> usize {
9596
self.meta >> 16
9697
}
98+
#[inline]
9799
pub fn data(&self) -> u16 {
98100
let data = self.meta & Self::DATA_MASK;
99101
data as u16
100102
}
103+
#[inline]
101104
pub fn as_str(&self) -> &'a str {
102105
// SAFETY: this instance was constructed from a string slice of length `len`, and lifetime `'a`.
103106
// It is sound to convert it back to a slice.
@@ -151,6 +154,7 @@ macro_rules! define_label {
151154
$id_name(ty, stuffed)
152155
}
153156
/// Returns the [`TypeId`] used to differentiate labels.
157+
#[inline]
154158
fn type_id(&self) -> ::core::any::TypeId {
155159
::core::any::TypeId::of::<Self>()
156160
}
@@ -164,12 +168,15 @@ macro_rules! define_label {
164168
}
165169

166170
impl $label_name for $id_name {
171+
#[inline]
167172
fn as_label(&self) -> Self {
168173
*self
169174
}
175+
#[inline]
170176
fn type_id(&self) -> ::core::any::TypeId {
171177
self.0
172178
}
179+
#[inline]
173180
fn data(&self) -> u16 {
174181
self.1.data()
175182
}

0 commit comments

Comments
 (0)