pub trait UnionParseError: From<ParseError> {
// Required method
fn as_parse_error(&self) -> Option<&ParseError>;
// Provided method
fn from_no_matching_variant(
node_id: NodeId,
variant: Option<String>,
best_match: Option<BestParseVariantMatch>,
_failures: &[(String, Self)],
) -> Self { ... }
}Expand description
Additional behavior required by ParseContext::parse_union.
Union parsing needs to synthesize a “no matching variant” error after all
variants have been tried. Some callers want that as a plain ParseError,
while others use a higher-level error type and treat it as a control signal.
Required Methods§
Sourcefn as_parse_error(&self) -> Option<&ParseError>
fn as_parse_error(&self) -> Option<&ParseError>
Returns the underlying ParseError when one exists.
Provided Methods§
Sourcefn from_no_matching_variant(
node_id: NodeId,
variant: Option<String>,
best_match: Option<BestParseVariantMatch>,
_failures: &[(String, Self)],
) -> Self
fn from_no_matching_variant( node_id: NodeId, variant: Option<String>, best_match: Option<BestParseVariantMatch>, _failures: &[(String, Self)], ) -> Self
Constructs the error returned when no union variant matches.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.