11use crate :: * ;
22
3+ /// Provides default implementation for FuncType.
34impl Default for FuncType {
5+ /// Returns the default value for FuncType, which is Unknown.
46 fn default ( ) -> Self {
57 Self :: Unknown
68 }
79}
810
11+ /// Implements the `FromStr` trait for `FuncType` to parse string representations into `FuncType` variants.
912impl FromStr for FuncType {
1013 type Err = String ;
1114
15+ /// Parses a string slice into a `FuncType`.
16+ ///
17+ /// # Arguments
18+ ///
19+ /// - `s`: The string slice to parse.
20+ ///
21+ /// # Returns
22+ ///
23+ /// - `Result<FuncType, String>`: Ok containing the `FuncType` if parsing is successful,
24+ /// or an Err containing a String error message if parsing fails.
1225 fn from_str ( s : & str ) -> Result < FuncType , std:: string:: String > {
1326 match s {
1427 GET => Ok ( FuncType :: Get ) ,
@@ -24,7 +37,7 @@ impl FuncType {
2437 /// Checks if the `FuncType` is `Get`.
2538 ///
2639 /// # Parameters
27- /// - `self`: The reference to the `FuncType` instance.
40+ /// - `self` - The reference to the `FuncType` instance.
2841 ///
2942 /// # Returns
3043 /// - `true` if the `FuncType` is `Get`; otherwise, `false`.
@@ -35,7 +48,7 @@ impl FuncType {
3548 /// Checks if the `FuncType` is `GetMut`.
3649 ///
3750 /// # Parameters
38- /// - `self`: The reference to the `FuncType` instance.
51+ /// - `self` - The reference to the `FuncType` instance.
3952 ///
4053 /// # Returns
4154 /// - `true` if the `FuncType` is `GetMut`; otherwise, `false`.
@@ -46,7 +59,7 @@ impl FuncType {
4659 /// Checks if the `FuncType` is `Set`.
4760 ///
4861 /// # Parameters
49- /// - `self`: The reference to the `FuncType` instance.
62+ /// - `self` - The reference to the `FuncType` instance.
5063 ///
5164 /// # Returns
5265 /// - `true` if the `FuncType` is `Set`; otherwise, `false`.
@@ -57,7 +70,7 @@ impl FuncType {
5770 /// Checks if the `FuncType` is `Debug`.
5871 ///
5972 /// # Parameters
60- /// - `self`: The reference to the `FuncType` instance.
73+ /// - `self` - The reference to the `FuncType` instance.
6174 ///
6275 /// # Returns
6376 /// - `true` if the `FuncType` is `Debug`; otherwise, `false`.
@@ -68,7 +81,7 @@ impl FuncType {
6881 /// Checks if the `FuncType` is `Unknown`.
6982 ///
7083 /// # Parameters
71- /// - `self`: The reference to the `FuncType` instance.
84+ /// - `self` - The reference to the `FuncType` instance.
7285 ///
7386 /// # Returns
7487 /// - `true` if the `FuncType` is `Unknown`; otherwise, `false`.
@@ -79,10 +92,10 @@ impl FuncType {
7992 /// Checks if the `FuncType` is `Unknown`.
8093 ///
8194 /// # Parameters
82- /// - `self `: The reference to the `FuncType` instance .
95+ /// - `func_type_str `: The string slice representing the function type to check .
8396 ///
8497 /// # Returns
85- /// - `true` if the `FuncType` is `Unknown`; otherwise, `false`.
98+ /// - `true` if the `FuncType` parsed from the string is not `Unknown`; otherwise, `false`.
8699 pub fn is_known ( func_type_str : & str ) -> bool {
87100 let func_type: FuncType = func_type_str. parse :: < FuncType > ( ) . unwrap_or_default ( ) ;
88101 func_type != Self :: Unknown
0 commit comments