teloxide-core 0.9.1

Core part of the `teloxide` library - telegram bot API client
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use bytes::{Bytes, BytesMut};
use tokio_util::codec::Decoder;

struct FileDecoder;

impl Decoder for FileDecoder {
    type Item = Bytes;
    type Error = std::io::Error;

    fn decode(&mut self, src: &mut BytesMut) -> Result<Option<Self::Item>, Self::Error> {
        if src.is_empty() {
            return Ok(None);
        }
        Ok(Some(src.split().freeze()))
    }
}