tinystr/
error.rs

1// This file is part of ICU4X. For terms of use, please see the file
2// called LICENSE at the top level of the ICU4X source tree
3// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ).
4
5use displaydoc::Display;
6
7#[cfg(feature = "std")]
8impl std::error::Error for TinyStrError {}
9
10#[derive(Display, Debug, PartialEq, Eq)]
11#[non_exhaustive]
12pub enum TinyStrError {
13    #[displaydoc("found string of larger length {len} when constructing string of length {max}")]
14    TooLarge { max: usize, len: usize },
15    #[displaydoc("tinystr types do not support strings with null bytes")]
16    ContainsNull,
17    #[displaydoc("attempted to construct TinyStrAuto from a non-ascii string")]
18    NonAscii,
19}