Internals
Error-code and IO mappings with their information-loss boundaries.
External representations
ErrorCode::from(&error) maps typed errors into numeric categories. The mapping is many-to-one: for example several protocol failures map to the timeout category. Preserve the original structured error internally when the exact cause matters.
ToIoErrorKind::to_io_error_kind() returns Option<std::io::ErrorKind>, because some failures have no meaningful IO equivalent. Under the serde feature, SerializedError exposes code, message and optional JSON details. That transport structure is distinct from the complete nested Rust error enum.
use strand_errors::{CryptoError, ErrorCode, StrandError, ToIoErrorKind};
let error = StrandError::Crypto(CryptoError::InvalidSignature);
let code = ErrorCode::from(&error);
assert_eq!(code as u32, 2001);
let io_mapping = error.to_io_error_kind();There are no top-level StrandError::Signature, Policy, PolicyDenied, InvalidBlock or Io variants. Use the actual nested variants documented in the source reference.
Source reference
Exact declarations and source provenance · Package features and manifest.