Skip to content

Commit 0c8498d

Browse files
committed
Sprinkle some inlines
1 parent 8d40345 commit 0c8498d

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

src/decl.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,30 +38,35 @@ pub(crate) const TAG_GC_PRIM_ARRAY_DUMP: u8 = 0x23;
3838
pub struct Id(usize);
3939

4040
impl From<Id> for usize {
41+
#[inline]
4142
fn from(val: Id) -> usize {
4243
val.0
4344
}
4445
}
4546

4647
impl From<usize> for Id {
48+
#[inline]
4749
fn from(id: usize) -> Id {
4850
Id(id)
4951
}
5052
}
5153

5254
impl From<Id> for u64 {
55+
#[inline]
5356
fn from(val: Id) -> u64 {
5457
val.0 as u64
5558
}
5659
}
5760

5861
impl From<u64> for Id {
62+
#[inline]
5963
fn from(id: u64) -> Id {
6064
Id(id as usize)
6165
}
6266
}
6367

6468
impl From<u32> for Id {
69+
#[inline]
6570
fn from(id: u32) -> Id {
6671
Id(id as usize)
6772
}
@@ -369,6 +374,7 @@ pub enum Error {
369374
}
370375

371376
impl From<io::Error> for Error {
377+
#[inline]
372378
fn from(error: io::Error) -> Self {
373379
Error::UnderlyingIOError(error)
374380
}

src/stream.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ impl<'data, 'hprof> MemoryHprofIterator<'data, 'hprof> {
8989
}
9090

9191
impl StreamHprofReader {
92+
#[inline]
9293
pub fn new() -> Self {
9394
Self {
9495
id_byteorder: ByteOrder::Native,
@@ -97,21 +98,25 @@ impl StreamHprofReader {
9798
}
9899
}
99100

101+
#[inline]
100102
pub fn with_id_byteorder(mut self, id_byteorder: ByteOrder) -> Self {
101103
self.id_byteorder = id_byteorder;
102104
self
103105
}
104106

107+
#[inline]
105108
pub fn with_load_primitive_arrays(mut self, flag: bool) -> Self {
106109
self.load_primitive_arrays = flag;
107110
self
108111
}
109112

113+
#[inline]
110114
pub fn with_load_object_arrays(mut self, flag: bool) -> Self {
111115
self.load_object_arrays = flag;
112116
self
113117
}
114118

119+
#[inline]
115120
pub fn read_hprof_from_stream<R: io::BufRead>(
116121
&self,
117122
stream: R,
@@ -120,6 +125,7 @@ impl StreamHprofReader {
120125
.map(ReadHprofIterator::new)
121126
}
122127

128+
#[inline]
123129
pub fn read_hprof_from_memory<'data, 'hprof>(
124130
&'hprof self,
125131
data: &'data [u8],
@@ -170,6 +176,7 @@ impl StreamHprofReader {
170176
}
171177

172178
impl Default for StreamHprofReader {
179+
#[inline]
173180
fn default() -> Self {
174181
Self::new()
175182
}

0 commit comments

Comments
 (0)