From 3a680d4738fb88de57fce3d3b6982025608ca819 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Sch=C3=A4fer?= Date: Sun, 30 Jun 2024 11:25:45 +0200 Subject: [PATCH] parsers: re-arrange data_forms validation implementation This is more in line with how we handle closely coupled specifications already. While there are subdirectories for "large" specifications (such as MUC and PubSub), those only refer to a single XEP document. When there are multiple separate XEP documents, we have separate modules for that. --- .../src/{data_forms/data_form.rs => data_forms.rs} | 4 ++-- parsers/src/data_forms/mod.rs | 13 ------------- .../validate.rs => data_forms_validate.rs} | 5 ----- parsers/src/lib.rs | 3 +++ 4 files changed, 5 insertions(+), 20 deletions(-) rename parsers/src/{data_forms/data_form.rs => data_forms.rs} (99%) delete mode 100644 parsers/src/data_forms/mod.rs rename parsers/src/{data_forms/validate.rs => data_forms_validate.rs} (99%) diff --git a/parsers/src/data_forms/data_form.rs b/parsers/src/data_forms.rs similarity index 99% rename from parsers/src/data_forms/data_form.rs rename to parsers/src/data_forms.rs index 9473c3ad..eb1b165e 100644 --- a/parsers/src/data_forms/data_form.rs +++ b/parsers/src/data_forms.rs @@ -4,7 +4,7 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. -use crate::data_forms::Validate; +use crate::data_forms_validate::Validate; use crate::media_element::MediaElement; use crate::ns; use crate::Element; @@ -387,7 +387,7 @@ impl From for Element { #[cfg(test)] mod tests { use super::*; - use crate::data_forms::{Datatype, Validate}; + use crate::data_forms_validate::{Datatype, Validate}; #[cfg(target_pointer_width = "32")] #[test] diff --git a/parsers/src/data_forms/mod.rs b/parsers/src/data_forms/mod.rs deleted file mode 100644 index 82e51d87..00000000 --- a/parsers/src/data_forms/mod.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) 2024 xmpp-rs contributors. -// -// This Source Code Form is subject to the terms of the Mozilla Public -// License, v. 2.0. If a copy of the MPL was not distributed with this -// file, You can obtain one at http://mozilla.org/MPL/2.0/. - -/// XEP-0004: Data Forms -pub mod data_form; - -pub mod validate; - -pub use data_form::*; -pub use validate::*; diff --git a/parsers/src/data_forms/validate.rs b/parsers/src/data_forms_validate.rs similarity index 99% rename from parsers/src/data_forms/validate.rs rename to parsers/src/data_forms_validate.rs index eb474f2a..07a330d6 100644 --- a/parsers/src/data_forms/validate.rs +++ b/parsers/src/data_forms_validate.rs @@ -4,11 +4,6 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. -//! XEP-0122: Data Forms Validation -//! -//! See [XEP-0122](https://xmpp.org/extensions/xep-0122.html) for the -//! specification. - use std::fmt::{Display, Formatter}; use std::str::FromStr; diff --git a/parsers/src/lib.rs b/parsers/src/lib.rs index 2f98701a..04dd15f4 100644 --- a/parsers/src/lib.rs +++ b/parsers/src/lib.rs @@ -120,6 +120,9 @@ pub mod caps; /// XEP-0118: User Tune pub mod tune; +/// XEP-0122: Data Forms Validation +pub mod data_forms_validate; + ///XEP-0153: vCard-Based Avatars pub mod vcard_update;