parsers: fix warnings in doc build

This commit is contained in:
Jonas Schäfer 2024-06-26 19:46:40 +02:00 committed by Link Mauve
parent cb09ab865c
commit cfbd58c1cd

View file

@ -5,7 +5,9 @@
// file, You can obtain one at http://mozilla.org/MPL/2.0/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
//! XEP-0122: Data Forms Validation //! XEP-0122: Data Forms Validation
//! https://xmpp.org/extensions/xep-0122.html#usecases-datatypes //!
//! See [XEP-0122](https://xmpp.org/extensions/xep-0122.html) for the
//! specification.
use std::fmt::{Display, Formatter}; use std::fmt::{Display, Formatter};
use std::str::FromStr; use std::str::FromStr;
@ -20,25 +22,25 @@ use crate::Error;
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub enum Method { pub enum Method {
/// … to indicate that the value(s) should simply match the field type and datatype constraints, /// … to indicate that the value(s) should simply match the field type and datatype constraints,
/// the <validate/> element shall contain a <basic/> child element. Using <basic/> validation, /// the `<validate/>` element shall contain a `<basic/>` child element. Using `<basic/>` validation,
/// the form interpreter MUST follow the validation rules of the datatype (if understood) and /// the form interpreter MUST follow the validation rules of the datatype (if understood) and
/// the field type. /// the field type.
/// ///
/// https://xmpp.org/extensions/xep-0122.html#usercases-validation.basic /// <https://xmpp.org/extensions/xep-0122.html#usercases-validation.basic>
Basic, Basic,
/// For "list-single" or "list-multi", to indicate that the user may enter a custom value /// For "list-single" or "list-multi", to indicate that the user may enter a custom value
/// (matching the datatype constraints) or choose from the predefined values, the <validate/> /// (matching the datatype constraints) or choose from the predefined values, the `<validate/>`
/// element shall contain an <open/> child element. The <open/> validation method applies to /// element shall contain an `<open/>` child element. The `<open/>` validation method applies to
/// "text-multi" differently; it hints that each value for a "text-multi" field shall be /// "text-multi" differently; it hints that each value for a "text-multi" field shall be
/// validated separately. This effectively turns "text-multi" fields into an open-ended /// validated separately. This effectively turns "text-multi" fields into an open-ended
/// "list-multi", with no options and all values automatically selected. /// "list-multi", with no options and all values automatically selected.
/// ///
/// https://xmpp.org/extensions/xep-0122.html#usercases-validation.open /// <https://xmpp.org/extensions/xep-0122.html#usercases-validation.open>
Open, Open,
/// To indicate that the value should fall within a certain range, the <validate/> element shall /// To indicate that the value should fall within a certain range, the `<validate/>` element shall
/// contain a <range/> child element. The 'min' and 'max' attributes of the <range/> element /// contain a `<range/>` child element. The 'min' and 'max' attributes of the `<range/>` element
/// specify the minimum and maximum values allowed, respectively. /// specify the minimum and maximum values allowed, respectively.
/// ///
/// The 'max' attribute specifies the maximum allowable value. This attribute is OPTIONAL. /// The 'max' attribute specifies the maximum allowable value. This attribute is OPTIONAL.
@ -47,11 +49,11 @@ pub enum Method {
/// The 'min' attribute specifies the minimum allowable value. This attribute is OPTIONAL. /// The 'min' attribute specifies the minimum allowable value. This attribute is OPTIONAL.
/// The value depends on the datatype in use. /// The value depends on the datatype in use.
/// ///
/// The <range/> element SHOULD possess either a 'min' or 'max' attribute, and MAY possess both. /// The `<range/>` element SHOULD possess either a 'min' or 'max' attribute, and MAY possess both.
/// If neither attribute is included, the processor MUST assume that there are no range /// If neither attribute is included, the processor MUST assume that there are no range
/// constraints. /// constraints.
/// ///
/// https://xmpp.org/extensions/xep-0122.html#usercases-validation.range /// <https://xmpp.org/extensions/xep-0122.html#usercases-validation.range>
Range { Range {
/// The 'min' attribute specifies the minimum allowable value. /// The 'min' attribute specifies the minimum allowable value.
min: Option<String>, min: Option<String>,
@ -59,13 +61,13 @@ pub enum Method {
max: Option<String>, max: Option<String>,
}, },
/// To indicate that the value should be restricted to a regular expression, the <validate/> /// To indicate that the value should be restricted to a regular expression, the `<validate/>`
/// element shall contain a <regex/> child element. The XML character data of this element is /// element shall contain a `<regex/>` child element. The XML character data of this element is
/// the pattern to apply. The syntax of this content MUST be that defined for POSIX extended /// the pattern to apply. The syntax of this content MUST be that defined for POSIX extended
/// regular expressions, including support for Unicode. The <regex/> element MUST contain /// regular expressions, including support for Unicode. The `<regex/>` element MUST contain
/// character data only. /// character data only.
/// ///
/// https://xmpp.org/extensions/xep-0122.html#usercases-validatoin.regex /// <https://xmpp.org/extensions/xep-0122.html#usercases-validatoin.regex>
Regex(String), Regex(String),
} }
@ -122,7 +124,7 @@ impl Display for DatatypeError {
/// Data Forms Validation Datatypes /// Data Forms Validation Datatypes
/// ///
/// https://xmpp.org/registrar/xdv-datatypes.html /// <https://xmpp.org/registrar/xdv-datatypes.html>
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub enum Datatype { pub enum Datatype {
/// A Uniform Resource Identifier Reference (URI) /// A Uniform Resource Identifier Reference (URI)
@ -194,27 +196,27 @@ pub struct Validate {
pub datatype: Option<Datatype>, pub datatype: Option<Datatype>,
/// The validation method. If no validation method is specified, form processors MUST /// The validation method. If no validation method is specified, form processors MUST
/// assume <basic/> validation. The <validate/> element SHOULD include one of the above /// assume `<basic/>` validation. The `<validate/>` element SHOULD include one of the above
/// validation method elements, and MUST NOT include more than one. /// validation method elements, and MUST NOT include more than one.
/// ///
/// Any validation method applied to a field of type "list-multi", "list-single", or "text-multi" /// Any validation method applied to a field of type "list-multi", "list-single", or "text-multi"
/// (other than <basic/>) MUST imply the same behavior as <open/>, with the additional constraints /// (other than `<basic/>`) MUST imply the same behavior as `<open/>`, with the additional constraints
/// defined by that method. /// defined by that method.
/// ///
/// https://xmpp.org/extensions/xep-0122.html#usecases-validation /// <https://xmpp.org/extensions/xep-0122.html#usecases-validation>
pub method: Option<Method>, pub method: Option<Method>,
/// For "list-multi", validation can indicate (via the <list-range/> element) that a minimum /// For "list-multi", validation can indicate (via the `<list-range/>` element) that a minimum
/// and maximum number of options should be selected and/or entered. This selection range /// and maximum number of options should be selected and/or entered. This selection range
/// MAY be combined with the other methods to provide more flexibility. /// MAY be combined with the other methods to provide more flexibility.
/// The <list-range/> element SHOULD be included only when the <field/> is of type "list-multi" /// The `<list-range/>` element SHOULD be included only when the `<field/>` is of type "list-multi"
/// and SHOULD be ignored otherwise. /// and SHOULD be ignored otherwise.
/// ///
/// The <list-range/> element SHOULD possess either a 'min' or 'max' attribute, and MAY possess /// The `<list-range/>` element SHOULD possess either a 'min' or 'max' attribute, and MAY possess
/// both. If neither attribute is included, the processor MUST assume that there are no /// both. If neither attribute is included, the processor MUST assume that there are no
/// selection constraints. /// selection constraints.
/// ///
/// https://xmpp.org/extensions/xep-0122.html#usecases-ranges /// <https://xmpp.org/extensions/xep-0122.html#usecases-ranges>
pub list_range: Option<ListRange>, pub list_range: Option<ListRange>,
} }