pub enum ParseResult {
Parsed(ParsedName),
Informal(Informal),
Unparsable(ParseError),
}Expand description
The 5.0.0 exceptionless result of parse, mirroring Java
org.gbif.nameparser.api.ParseResult: a structurally Parsed name, an
Informal semistructured name (a taxon anchor carrying a provisional
designation, e.g. Rhizobium sp. RMCC TR1811), or an Unparsable
classification (virus, hybrid formula, placeholder, BOLD BIN, …). The 5.5%-of-corpus informal
band is split off from Parsed at the parse boundary — see the verbatim-corpus study.
Parsed is far larger than the other two variants (it wraps the ~1 KB ParsedName vs ~56 B
for Informal/ParseError), so clippy::large_enum_variant fires — but Parsed is the
dominant outcome (≈89% of the corpus) and the value is decomposed immediately at the call
boundary, so boxing it would add a heap allocation to the common path for no real gain. This
mirrors parse_name’s own Result<ParsedName, ParseError>, which carries the identical size
profile unboxed.
Variants§
Parsed(ParsedName)
A structurally parsed name carrying the full ParsedName atoms.
Informal(Informal)
An informal / semistructured name: a supraspecific anchor + a provisional, non-code
designation, with no species epithet. See Informal.
Unparsable(ParseError)
A string that is not a parsable scientific name (virus, hybrid formula, placeholder, …).
Implementations§
Source§impl ParseResult
impl ParseResult
Sourcepub fn type_(&self) -> NameType
pub fn type_(&self) -> NameType
The name type, available on every variant (Java ParseResult.type()).
Sourcepub fn code(&self) -> Option<NomCode>
pub fn code(&self) -> Option<NomCode>
The nomenclatural code when known, else None — available on every variant (Java code()).
Sourcepub fn parsed(&self) -> Option<&ParsedName>
pub fn parsed(&self) -> Option<&ParsedName>
The parsed name if this is ParseResult::Parsed, else None (Java parsed()).
ParseResult::Informal and ParseResult::Unparsable carry no ParsedName.
Sourcepub fn is_parsable(&self) -> bool
pub fn is_parsable(&self) -> bool
True iff this carries a structured ParsedName — i.e. is a ParseResult::Parsed
(Java isParsable()).