torrust_index/config/
validator.rs

1//! Trait to validate the whole settings of sections of the settings.
2use thiserror::Error;
3
4/// Errors that can occur validating the configuration.
5#[derive(Error, Debug)]
6pub enum ValidationError {
7    #[error("UDP private trackers are not supported. URL schemes for private tracker URLs must be HTTP ot HTTPS")]
8    UdpTrackersInPrivateModeNotSupported,
9}
10
11pub trait Validator {
12    /// # Errors
13    ///
14    /// Will return an error if the configuration is invalid.
15    fn validate(&self) -> Result<(), ValidationError>;
16}