Added some inline.

This commit is contained in:
2018-01-10 14:18:13 +01:00
parent 62f29babc7
commit 70fda1c649

View File

@@ -92,17 +92,18 @@ impl convert::From<u64> for ByteNgram {
pub struct ByteNgramReader<R: Read> { pub struct ByteNgramReader<R: Read> {
inner: Bytes<R>, inner: Bytes<R>,
token: u64,
count: u64, count: u64,
token: u64,
mask: u64, mask: u64,
} }
impl<R: Read> ByteNgramReader<R> { impl<R: Read> ByteNgramReader<R> {
#[inline]
pub fn new(inner: R) -> Self { pub fn new(inner: R) -> Self {
ByteNgramReader { ByteNgramReader {
inner: inner.bytes(), inner: inner.bytes(),
token: 0,
count: 0, count: 0,
token: 0,
mask: 0, mask: 0,
} }
} }
@@ -111,6 +112,7 @@ impl<R: Read> ByteNgramReader<R> {
impl<R: Read> Iterator for ByteNgramReader<R> { impl<R: Read> Iterator for ByteNgramReader<R> {
type Item = ByteNgram; type Item = ByteNgram;
#[inline]
fn next(&mut self) -> Option<Self::Item> { fn next(&mut self) -> Option<Self::Item> {
if self.mask == 0 { if self.mask == 0 {
if let Some(Ok(byte)) = self.inner.next() { if let Some(Ok(byte)) = self.inner.next() {