Skip to main content

Module format

Module format 

Source
Expand description

Port of Java org.gbif.nameparser.util.NameFormatter — renders a ParsedName back into a formatted scientific-name string.

The Java class exposes a family of convenience methods (canonical, canonicalWithoutAuthorship, canonicalMinimal, canonicalComplete, canonicalCompleteHtml, authorshipComplete, authorString) that all delegate to one private buildName(ParsedName, 16 booleans). This port keeps that exact shape: the 16 positional booleans become a named [Flags] struct (safer to read than 16 positional bools while preserving the same semantics), each public method fills the same flag values Java passes, and [build_name] mirrors the Java control flow statement for statement. The public entry points hang off ParsedName as methods so bindings can call e.g. pn.canonical_name().

Cross-validated byte-for-byte against Java NameFormatter over the full corpus by tests/format_golden.rs (the Java oracle emits the same five renderings per name).