feat(proto): add generic proto reader

This commit is contained in:
Jindřich Moravec 2023-12-11 16:53:21 +01:00
parent 67af05ea42
commit 413e0216e3
5 changed files with 87 additions and 0 deletions

View file

@ -0,0 +1,22 @@
use crate::reader::utils::AsyncPeek;
use tokio::io::AsyncBufRead;
pub struct ProtoReader<R>
where
R: AsyncBufRead + AsyncPeek + Unpin + Send,
{
pub(super) inner: R,
pub(super) msg_len_limit: i32,
}
impl<R> ProtoReader<R>
where
R: AsyncBufRead + AsyncPeek + Unpin + Send,
{
pub fn new(reader: R, msg_len_limit: i32) -> ProtoReader<R> {
ProtoReader {
inner: reader,
msg_len_limit,
}
}
}