use std::fmt::Debug;
use std::fmt::Formatter;
use std::fmt::Result;
use crate::ValidationPath;
use crate::ValidationValue;
#[derive(Clone, Copy)]
pub struct NamedValidationDependency<'a> {
pub(super) name: &'static str,
pub(super) value: ValidationValue<'a>,
pub(super) path: Option<&'a ValidationPath>,
}
impl<'a> NamedValidationDependency<'a> {
#[must_use]
#[inline]
pub const fn new(name: &'static str, value: ValidationValue<'a>) -> Self {
Self {
name,
value,
path: None,
}
}
#[must_use]
#[inline]
pub const fn with_path(mut self, path: &'a ValidationPath) -> Self {
self.path = Some(path);
self
}
}
impl Debug for NamedValidationDependency<'_> {
fn fmt(&self, formatter: &mut Formatter<'_>) -> Result {
formatter
.debug_struct("NamedValidationDependency")
.field("has_path", &self.path.is_some())
.finish_non_exhaustive()
}
}