pub enum AioError {
TimedOut,
Cancelled,
Operation(NonZeroU32),
}Expand description
Errors that can occur during async I/O operations.
AioError represents the various failure conditions that can occur when
performing asynchronous operations with NNG sockets.
§Error categories
§Transient errors
AioError::TimedOut: Operation exceeded its timeout period. Only returned if a timeout is specifically set for the operation, which is not usually the case.AioError::Cancelled: Operation was cancelled (usually due to dropping the future). This error variant is usually not exposed to application code, and tends to only arise internally in the anng state machines.
§Protocol/Network errors
AioError::Operation: Underlying NNG operation failed (see error code for details).
Variants§
TimedOut
Operation exceeded its timeout period.
This indicates the operation was started but did not complete within the configured timeout. The operation has been cancelled and can be safely retried.
§Common Causes
- Network connectivity issues
- Remote endpoint overloaded or unresponsive
- Configured timeout too aggressive for network conditions
Cancelled
Operation was cancelled before completion.
This typically occurs when:
- The future was dropped before completion
- A timeout was applied externally (e.g.,
tokio::time::timeout) - The application is shutting down
Cancelled operations are cleaned up properly and leave the socket in a consistent state.
Operation(NonZeroU32)
Underlying NNG operation failed with the given error code.
The error code corresponds to NNG’s error constants. Common codes include:
NNG_ECONNREFUSED(61): Connection refused by remote endpointNNG_ECONNRESET(54): Connection reset by peerNNG_EHOSTUNREACH(65): Host unreachableNNG_EADDRINUSE(48): Address already in useNNG_ESTATE(71): Protocol state violation
See the NNG documentation
for a complete list of error codes. You can also get them from the nng_sys crate.