pub enum ParcodeError {
Io(Arc<Error>),
Serialization(String),
Compression(String),
Format(String),
Internal(String),
}Expand description
The master error enum covering all failure domains in Parcode.
This enum represents all possible error conditions that can occur during Parcode operations. Each variant corresponds to a specific failure domain and contains contextual information about the error.
§Variants
- Io: Low-level I/O failures (file not found, permission denied, disk full, etc.)
- Serialization: Bincode encoding/decoding failures (type mismatch, invalid data, etc.)
- Compression: Compression algorithm failures (corrupted compressed data, etc.)
- Format: File format validation failures (wrong magic bytes, version mismatch, corruption)
- Internal: Logic errors in the library (should not occur in production; please report as bugs)
§Cloneability
This type is Clone to support error sharing across threads and storage for later analysis.
I/O errors are wrapped in Arc to make cloning efficient.
§Examples
use parcode::ParcodeError;
fn check_error(err: &ParcodeError) {
match err {
ParcodeError::Io(e) => println!("I/O error: {}", e),
ParcodeError::Format(msg) => println!("Format error: {}", msg),
_ => println!("Other error"),
}
}Variants§
Io(Arc<Error>)
Low-level I/O failure (disk full, permissions, network errors, etc.).
The underlying io::Error is wrapped in an Arc to make the error Clone.
This allows errors to be shared across threads without expensive copying.
§Common Causes
- File not found
- Permission denied
- Disk full
- Network interruption (for network file systems)
- Hardware failure
Serialization(String)
Serialization or deserialization failure (bincode).
This error occurs when bincode cannot encode or decode data, typically due to:
- Type mismatches between serialized and deserialized types
- Invalid or corrupted serialized data
- Unsupported types or features
The string contains a detailed error message from bincode.
Compression(String)
Compression algorithm failure.
This error occurs when compression or decompression fails, typically due to:
- Corrupted compressed data
- Unsupported compression algorithm ID
- Compression buffer overflow
The string contains a detailed error message from the compression library.
Format(String)
The file format is invalid, corrupted, or has a version mismatch.
This error occurs when the file does not conform to the Parcode V4 format:
- Wrong magic bytes (not “PAR4”)
- Unsupported version number
- Truncated file (missing header or chunks)
- Corrupted chunk metadata
- Invalid child references
The string contains a detailed description of the format violation.
Internal(String)
Logic error in the graph scheduler or other internal components.
This error should not occur in production. If you encounter this error, it likely indicates a bug in the library. Please report it with a minimal reproduction case.
§Common Causes (all indicate bugs)
- Cyclic dependencies in the graph
- Mutex poisoning
- Invalid node IDs
- Missing child results
The string contains diagnostic information about the internal error.
Trait Implementations§
Source§impl Clone for ParcodeError
impl Clone for ParcodeError
Source§fn clone(&self) -> ParcodeError
fn clone(&self) -> ParcodeError
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ParcodeError
impl Debug for ParcodeError
Source§impl Display for ParcodeError
impl Display for ParcodeError
Source§impl Error for ParcodeError
impl Error for ParcodeError
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
Auto Trait Implementations§
impl Freeze for ParcodeError
impl !RefUnwindSafe for ParcodeError
impl Send for ParcodeError
impl Sync for ParcodeError
impl Unpin for ParcodeError
impl !UnwindSafe for ParcodeError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more