Skip to content

Commit 2cc5bbf

Browse files
committed
Inline buffer methods
1 parent 08a163c commit 2cc5bbf

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

postgres-protocol/src/message/backend.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,14 +285,17 @@ struct Buffer {
285285
}
286286

287287
impl Buffer {
288+
#[inline]
288289
fn slice(&self) -> &[u8] {
289290
&self.bytes[self.idx..]
290291
}
291292

293+
#[inline]
292294
fn is_empty(&self) -> bool {
293295
self.slice().is_empty()
294296
}
295297

298+
#[inline]
296299
fn read_cstr(&mut self) -> io::Result<Bytes> {
297300
match memchr(0, self.slice()) {
298301
Some(pos) => {
@@ -309,6 +312,7 @@ impl Buffer {
309312
}
310313
}
311314

315+
#[inline]
312316
fn read_all(&mut self) -> Bytes {
313317
let buf = self.bytes.slice_from(self.idx);
314318
self.idx = self.bytes.len();
@@ -317,6 +321,7 @@ impl Buffer {
317321
}
318322

319323
impl Read for Buffer {
324+
#[inline]
320325
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
321326
let len = {
322327
let slice = self.slice();

0 commit comments

Comments
 (0)