rs_bytebuffer/byte_buf/error.rs
1use std::fmt::{Debug, Formatter};
2use std::result::Result;
3
4pub enum ErrorType {
5 ReadableShortage
6}
7
8impl ErrorType {
9 fn as_str(&self) -> &'static str{
10 match *self {
11 ErrorType::ReadableShortage => "可读长度不够"
12 }
13 }
14}
15
16impl Debug for ErrorType {
17 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
18 Debug::fmt(self.as_str(), f)
19 }
20}
21
22pub type ByteBufResult<T> = Result<T, ErrorType>;