1
//! Miscellaneous straightforward error structs for particular situations
2

            
3
use thiserror::Error;
4

            
5
/// Error type indicating that an input was incomplete, and could not be
6
/// processed.
7
///
8
/// This type is kept separate from most other error types since it is not a
9
/// true error; usually, it just means that the calling function should read
10
/// more data and try again.
11
///
12
/// Don't return this error type for parsing errors that _can't_ be recovered
13
/// from by reading more data.
14
#[derive(Clone, Debug, Default, Error)]
15
#[error("Incomplete data; more input needed")]
16
#[non_exhaustive]
17
pub struct Truncated;
18

            
19
impl Truncated {
20
    /// Return a new [`Truncated`] instance.
21
308
    pub fn new() -> Self {
22
308
        Default::default()
23
308
    }
24
}