In Rust's chrono library there is this code in src/format/mod.rs#L338-L345:
pub struct ParseError(ParseErrorKind);
enum ParseErrorKind {
OutOfRange,
...
}
- In the first line, what does the syntax
struct ParseError(ParseErrorKind)mean? Is enumParseErrorKindsomewhat "aliased" as a struct calledParseError, or isParseErrora struct that contains an anonymous field of enum typeParseErrorKind? If the latter, how would one access the field? Or is this something else? - What is the advantage of using this
structsyntax? Why not useParseErrorKindas a type directly (instead of wrapping it into a struct)?