pub enum BincodeError {
Enc(Box<EncodeError>),
Dec(Box<DecodeError>),
}Expand description
Wrapper for bincode serialization and deserialization errors.
bincode 序列化和反序列化错误的包装器。
§Purpose | 目的
This wrapper provides a consistent error handling interface for bincode
operations within the library. It abstracts the underlying bincode error
types while preserving error information and source chains.
此包装器为库内的 bincode 操作提供一致的错误处理接口。
它抽象了底层的 bincode 错误类型,同时保留错误信息和源链。
§Usage Context | 使用上下文
These errors typically occur during:
- Key serialization for storage or transmission
- Key deserialization from stored or received data
- Algorithm parameter encoding/decoding
- Ciphertext metadata serialization
这些错误通常发生在:
- 用于存储或传输的密钥序列化
- 从存储或接收的数据进行密钥反序列化
- 算法参数编码/解码
- 密文元数据序列化
Variants§
Enc(Box<EncodeError>)
Serialization (encoding) operation failed.
序列化(编码)操作失败。
This occurs when converting Rust data structures to binary format fails. Common causes include:
- Insufficient output buffer space
- Unsupported data types
- Memory allocation failures
当将 Rust 数据结构转换为二进制格式失败时发生。 常见原因包括:
- 输出缓冲区空间不足
- 不支持的数据类型
- 内存分配失败
Dec(Box<DecodeError>)
Deserialization (decoding) operation failed.
反序列化(解码)操作失败。
This occurs when converting binary data back to Rust structures fails. Common causes include:
- Corrupted or truncated input data
- Version incompatibilities
- Invalid data format
- Insufficient input data
当将二进制数据转换回 Rust 结构失败时发生。 常见原因包括:
- 损坏或截断的输入数据
- 版本不兼容
- 无效的数据格式
- 输入数据不足
Trait Implementations§
Source§impl Debug for BincodeError
impl Debug for BincodeError
Source§impl Display for BincodeError
impl Display for BincodeError
Source§impl Error for BincodeError
impl Error for BincodeError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
Source§impl From<BincodeError> for FormatError
impl From<BincodeError> for FormatError
Source§fn from(source: BincodeError) -> Self
fn from(source: BincodeError) -> Self
Source§impl From<DecodeError> for BincodeError
impl From<DecodeError> for BincodeError
Source§fn from(err: DecodeError) -> Self
fn from(err: DecodeError) -> Self
Converts a bincode decoding error into our wrapper type.
将 bincode 解码错误转换为我们的包装器类型。
Source§impl From<EncodeError> for BincodeError
impl From<EncodeError> for BincodeError
Source§fn from(err: EncodeError) -> Self
fn from(err: EncodeError) -> Self
Converts a bincode encoding error into our wrapper type.
将 bincode 编码错误转换为我们的包装器类型。