1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::validation::ToDefaultMessage;

use super::CustomMessage;

pub trait IntoError<E>: Sized
where
    E: ToDefaultMessage,
{
    fn into_error(self) -> crate::validation::Error {
        self.into_error_by(CustomMessage {
            message_fn: E::to_default_message,
            #[cfg(feature = "fluent")]
            fluent_message: None,
        })
    }

    fn into_error_by(self, custom: CustomMessage<E>) -> crate::validation::Error;
}