11// SPDX-License-Identifier: Apache-2.0
22
3- //! Parsing of [ simple_extensions::ArgumentsItem].
3+ //! Parsing of type arguments: [` simple_extensions::ArgumentsItem` ].
44
55use std:: { collections:: HashSet , ops:: Deref } ;
66
@@ -11,21 +11,24 @@ use crate::{
1111 text:: simple_extensions,
1212} ;
1313
14- /// A parsed [simple_extensions::ArgumentsItem].
14+ /// A parsed [` simple_extensions::ArgumentsItem` ].
1515#[ derive( Clone , Debug ) ]
1616pub enum ArgumentsItem {
17- /// Arguments that support a fixed set of declared values as constant arguments.
17+ /// Arguments that support a fixed set of declared values as constant
18+ /// arguments.
1819 EnumArgument ( EnumerationArg ) ,
1920
2021 /// Arguments that refer to a data value.
2122 ValueArgument ( ValueArg ) ,
2223
23- /// Arguments that are used only to inform the evaluation and/or type derivation of the function.
24+ /// Arguments that are used only to inform the evaluation and/or type
25+ /// derivation of the function.
2426 TypeArgument ( TypeArg ) ,
2527}
2628
2729impl ArgumentsItem {
28- /// Parses an `Option<String>` field, rejecting it if an empty string is provided.
30+ /// Parses an `Option<String>` field, rejecting it if an empty string is
31+ /// provided.
2932 #[ inline]
3033 fn parse_optional_string (
3134 name : & str ,
@@ -75,7 +78,7 @@ impl From<ArgumentsItem> for simple_extensions::ArgumentsItem {
7578 }
7679}
7780
78- /// Parse errors for [simple_extensions::ArgumentsItem].
81+ /// Parse errors for [` simple_extensions::ArgumentsItem` ].
7982#[ derive( Debug , Error , PartialEq ) ]
8083pub enum ArgumentsItemError {
8184 /// Invalid enumeration options.
@@ -103,21 +106,21 @@ pub struct EnumerationArg {
103106impl EnumerationArg {
104107 /// Returns the name of this argument.
105108 ///
106- /// See [simple_extensions::EnumerationArg::name].
109+ /// See [` simple_extensions::EnumerationArg::name` ].
107110 pub fn name ( & self ) -> Option < & String > {
108111 self . name . as_ref ( )
109112 }
110113
111114 /// Returns the description of this argument.
112115 ///
113- /// See [simple_extensions::EnumerationArg::description].
116+ /// See [` simple_extensions::EnumerationArg::description` ].
114117 pub fn description ( & self ) -> Option < & String > {
115118 self . description . as_ref ( )
116119 }
117120
118121 /// Returns the options of this argument.
119122 ///
120- /// See [simple_extensions::EnumerationArg::options].
123+ /// See [` simple_extensions::EnumerationArg::options` ].
121124 pub fn options ( & self ) -> & EnumOptions {
122125 & self . options
123126 }
@@ -210,7 +213,7 @@ impl From<EnumOptions> for simple_extensions::EnumOptions {
210213 }
211214}
212215
213- /// Parse errors for [simple_extensions::EnumOptions].
216+ /// Parse errors for [` simple_extensions::EnumOptions` ].
214217#[ derive( Debug , Error , PartialEq ) ]
215218pub enum EnumOptionsError {
216219 /// Empty list.
@@ -237,35 +240,35 @@ pub struct ValueArg {
237240
238241 /// A fully defined type or a type expression.
239242 ///
240- /// TODO: parse this to a typed representation (likely using the `TypeExpr` parser)
241- /// so the caller does not have to interpret the raw string.
243+ /// TODO: parse this to a typed representation (likely using the `TypeExpr`
244+ /// parser) so the caller does not have to interpret the raw string.
242245 value : simple_extensions:: Type ,
243246
244- /// Whether this argument is required to be a constant for invocation.
245- /// For example, in some system a regular expression pattern would only be accepted as a literal
246- /// and not a column value reference.
247+ /// Whether this argument is required to be a constant for invocation. For
248+ /// example, in some system a regular expression pattern would only be
249+ /// accepted as a literal and not a column value reference.
247250 constant : Option < bool > ,
248251}
249252
250253impl ValueArg {
251254 /// Returns the name of this argument.
252255 ///
253- /// See [simple_extensions::ValueArg::name].
256+ /// See [` simple_extensions::ValueArg::name` ].
254257 pub fn name ( & self ) -> Option < & String > {
255258 self . name . as_ref ( )
256259 }
257260
258261 /// Returns the description of this argument.
259262 ///
260- /// See [simple_extensions::ValueArg::description].
263+ /// See [` simple_extensions::ValueArg::description` ].
261264 pub fn description ( & self ) -> Option < & String > {
262265 self . description . as_ref ( )
263266 }
264267
265268 /// Returns the constant of this argument.
266269 /// Defaults to `false` if the underlying value is `None`.
267270 ///
268- /// See [simple_extensions::ValueArg::constant].
271+ /// See [` simple_extensions::ValueArg::constant` ].
269272 pub fn constant ( & self ) -> bool {
270273 self . constant . unwrap_or ( false )
271274 }
@@ -309,33 +312,33 @@ impl From<ValueArg> for ArgumentsItem {
309312 }
310313}
311314
312- /// Arguments that are used only to inform the evaluation and/or type derivation of the function .
315+ /// A type argument to a parameterized type, e.g. the `T` in `List<T>` .
313316#[ derive( Clone , Debug , PartialEq ) ]
314317pub struct TypeArg {
315- /// A human-readable name for this argument to help clarify use.
318+ /// A human-readable name for this argument to clarify use.
316319 name : Option < String > ,
317320
318321 /// Additional description for this argument.
319322 description : Option < String > ,
320323
321324 /// A partially or completely parameterized type. E.g. `List<K>` or `K`.
322325 ///
323- /// TODO: parse this to a typed representation (likely using the `TypeExpr` parser)
324- /// so the caller does not have to interpret the raw string.
326+ /// TODO: parse this to a typed representation (likely using the `TypeExpr`
327+ /// parser) so the caller does not have to interpret the raw string.
325328 type_ : String ,
326329}
327330
328331impl TypeArg {
329332 /// Returns the name of this argument.
330333 ///
331- /// See [simple_extensions::TypeArg::name].
334+ /// See [` simple_extensions::TypeArg::name` ].
332335 pub fn name ( & self ) -> Option < & String > {
333336 self . name . as_ref ( )
334337 }
335338
336339 /// Returns the description of this argument.
337340 ///
338- /// See [simple_extensions::TypeArg::description].
341+ /// See [` simple_extensions::TypeArg::description` ].
339342 pub fn description ( & self ) -> Option < & String > {
340343 self . description . as_ref ( )
341344 }
0 commit comments