mcproto_codec/lib.rs
1pub mod varint;
2pub mod varlong;
3
4use thiserror::Error;
5pub use varint::{VarIntRead, VarIntWrite}; // 重导出
6pub use varlong::{VarLongRead, VarLongWrite};
7#[derive(Error, Debug)]
8pub enum CodecError {
9 #[error("IO error occurred as codec: {0}")]
10 Io(#[from] std::io::Error),
11
12 #[error("VarInt too long, max is 2^31-1")]
13 VarIntOverflow,
14
15 #[error("Unexpected end of data")]
16 UnexpectedEof,
17
18 #[error("VarLong too long, max is 2^63-1")]
19 VarLongOverflow,
20}