BincodeError

Enum BincodeError 

Source
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

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for BincodeError

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for BincodeError

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<BincodeError> for FormatError

Source§

fn from(source: BincodeError) -> Self

Converts to this type from the input type.
Source§

impl From<DecodeError> for BincodeError

Source§

fn from(err: DecodeError) -> Self

Converts a bincode decoding error into our wrapper type.

bincode 解码错误转换为我们的包装器类型。

Source§

impl From<EncodeError> for BincodeError

Source§

fn from(err: EncodeError) -> Self

Converts a bincode encoding error into our wrapper type.

bincode 编码错误转换为我们的包装器类型。

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V