non_empty_str/
empty.rs

1//! Emptiness errors.
2
3#[cfg(feature = "diagnostics")]
4use miette::Diagnostic;
5
6use thiserror::Error;
7
8/// The message for errors returned on empty strings.
9pub const EMPTY: &str = "the string is empty";
10
11/// Represents errors that occur when the input string is empty.
12#[derive(Debug, Error)]
13#[error("the string is empty")]
14#[cfg_attr(
15    feature = "diagnostics",
16    derive(Diagnostic),
17    diagnostic(code(non_empty_str::empty), help("make sure the string is non-empty"))
18)]
19pub struct Empty;