Streaming Tree ARchive format
1use crate::error::StarError;
2use crate::parser::StarParser;
3use crate::types::StarItem;
4use bytes::{Buf, BytesMut};
5use tokio_util::codec::Decoder;
6
7impl Decoder for StarParser {
8 type Item = StarItem;
9 type Error = StarError;
10
11 fn decode(&mut self, src: &mut BytesMut) -> Result<Option<Self::Item>, Self::Error> {
12 let (consumed, item) = self.parse(src)?;
13 src.advance(consumed);
14 Ok(item)
15 }
16}