actix_web_validation/
lib.rs1#![doc = include_str!("../README.md")]
2
3#[cfg(feature = "custom")]
4pub mod custom;
5#[cfg(feature = "garde")]
6pub mod garde;
7#[cfg(feature = "validator")]
8pub mod validator;
9
10#[cfg(all(feature = "validator", not(feature = "garde"), not(feature = "custom")))]
11pub use crate::validator::Validated;
12
13#[cfg(all(feature = "garde", not(feature = "validator"), not(feature = "custom")))]
14pub use crate::garde::Validated;
15
16#[cfg(all(feature = "custom", not(feature = "validator"), not(feature = "garde")))]
17pub use crate::custom::Validated;
18
19macro_rules! validated_definition {
20 () => {
21 impl<T> Validated<T> {
22 pub fn into_inner(self) -> T {
23 self.0
24 }
25 }
26
27 impl<T> std::ops::Deref for Validated<T> {
28 type Target = T;
29
30 fn deref(&self) -> &Self::Target {
31 &self.0
32 }
33 }
34
35 impl<T> std::ops::DerefMut for Validated<T> {
36 fn deref_mut(&mut self) -> &mut Self::Target {
37 &mut self.0
38 }
39 }
40
41 impl<T> Debug for Validated<T>
42 where
43 T: Debug,
44 {
45 #[inline]
46 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
47 f.debug_tuple("Validated").field(&self.0).finish()
48 }
49 }
50 };
51}
52
53pub(crate) use validated_definition;