1 /// Semantics for a piece of error information 2 #[derive(Copy, Clone, Debug, PartialEq, Eq)] 3 #[non_exhaustive] 4 pub enum ContextKind { 5 /// The cause of the error 6 InvalidSubcommand, 7 /// The cause of the error 8 InvalidArg, 9 /// Existing arguments 10 PriorArg, 11 /// Accepted values 12 ValidValue, 13 /// Rejected values 14 InvalidValue, 15 /// Number of values present 16 ActualNumValues, 17 /// Number of allowed values 18 ExpectedNumValues, 19 /// Minimum number of allowed values 20 MinValues, 21 /// Number of occurrences present 22 ActualNumOccurrences, 23 /// Maximum number of allowed occurrences 24 MaxOccurrences, 25 /// Potential fix for the user 26 SuggestedCommand, 27 /// Potential fix for the user 28 SuggestedSubcommand, 29 /// Potential fix for the user 30 SuggestedArg, 31 /// Potential fix for the user 32 SuggestedValue, 33 /// Trailing argument 34 TrailingArg, 35 /// A usage string 36 Usage, 37 /// An opaque message to the user 38 Custom, 39 } 40 41 /// A piece of error information 42 #[derive(Clone, Debug, PartialEq, Eq)] 43 #[non_exhaustive] 44 pub enum ContextValue { 45 /// [`ContextKind`] is self-sufficient, no additional information needed 46 None, 47 /// A single value 48 Bool(bool), 49 /// A single value 50 String(String), 51 /// Many values 52 Strings(Vec<String>), 53 /// A single value 54 Number(isize), 55 } 56