Skip to main content

binger_udp/
error.rs

1use std::io;
2
3/// Errors that can occur in binger-udp operations.
4///
5/// Covers batch overflow and I/O errors from the operating system.
6///
7/// # Conversions
8///
9/// [`std::io::Error`] is automatically converted into [`BingerError::Io`]
10/// via the [`From`] trait, so `?` works naturally with I/O operations.
11#[derive(Debug, thiserror::Error)]
12#[allow(clippy::module_name_repetitions)]
13pub enum BingerError {
14    /// Batch is full — no more entries can be added.
15    #[error("batch is full (capacity: {capacity})")]
16    BatchFull { capacity: usize },
17
18    /// Transparent stdio error from the OS.
19    #[error("I/O error: {0}")]
20    Io(#[from] io::Error),
21}