Every fallible function in the hayate crate returns Result<T, EngineError>. EngineError is a single flat enum that covers the full range of failure modes across the engine — from file system I/O errors and QUIC transport failures to cryptographic handshake problems and protocol mismatches. Because all errors are unified under one type, you can handle them with a single match arm in most callers, and drill into specifics only where your application needs to recover or provide user-facing messages.
EngineError Variants
Matching Errors
Match on specific variants to give users actionable feedback or apply targeted recovery logic:
Cancelling a Transfer
You can abort an in-progress transfer at any time by returning Err(EngineError::Cancelled(...)) from the progress callback. The engine stops sending immediately and propagates the error as the return value of .send() or .receive():
This is the recommended way to implement user-initiated cancel buttons, size guards, or timeout policies at the application layer.
EngineError is marked #[non_exhaustive]. New variants may be added in future minor releases without a breaking change. Always include a wildcard arm (Err(e) => ...) at the end of your match to ensure your code compiles against newer versions of the crate.