1
//! Declare the "Truncated" error type.
2

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

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