pub enum Rank {
Show 117 variants
Superdomain,
Domain,
Subdomain,
Infradomain,
Empire,
Realm,
Subrealm,
Superkingdom,
Kingdom,
Subkingdom,
Infrakingdom,
Superphylum,
Phylum,
Subphylum,
Infraphylum,
Parvphylum,
Microphylum,
Nanophylum,
Claudius,
Gigaclass,
Megaclass,
Superclass,
Class,
Subclass,
Infraclass,
Subterclass,
Parvclass,
Superdivision,
DivisionZoology,
Subdivision,
Infradivision,
Superlegion,
Legion,
Sublegion,
Infralegion,
Megacohort,
Supercohort,
Cohort,
Subcohort,
Infracohort,
Gigaorder,
Magnorder,
Grandorder,
Mirorder,
Superorder,
Order,
Nanorder,
Hypoorder,
Minorder,
Suborder,
Infraorder,
Parvorder,
SupersectionZoology,
SectionZoology,
SubsectionZoology,
SuperseriesZoology,
SeriesZoology,
SubseriesZoology,
Falanx,
Gigafamily,
Megafamily,
Grandfamily,
Superfamily,
Epifamily,
Family,
Subfamily,
Infrafamily,
Supertribe,
Tribe,
Subtribe,
Infratribe,
SupragenericName,
Supergenus,
Genus,
Subgenus,
Infragenus,
DivisionBotany,
SupersectionBotany,
SectionBotany,
SubsectionBotany,
SuperseriesBotany,
SeriesBotany,
SubseriesBotany,
InfragenericName,
SpeciesAggregate,
Species,
InfraspecificName,
Grex,
Klepton,
Subspecies,
CultivarGroup,
Convariety,
InfrasubspecificName,
Proles,
Natio,
Aberration,
Morph,
Supervariety,
Variety,
Subvariety,
Superform,
Form,
Subform,
Pathovar,
Biovar,
Chemovar,
Morphovar,
Phagovar,
Serovar,
Chemoform,
FormaSpecialis,
Lusus,
Cultivar,
Mutatio,
Strain,
Other,
Unranked,
}Expand description
Java org.gbif.nameparser.api.Rank (Rank.java, 637 lines) — the full 117-constant
taxonomic rank enumeration, ported in EXACT Java declaration order (verified mechanically
against Rank.java line-by-line, SUPERDOMAIN first through UNRANKED last — see the
exhaustive round-trip test rank_all_117_variants_in_java_declaration_order below).
Declaration order is load-bearing: Rust numbers enum discriminants 0..117 in declaration
order exactly like Java’s Enum.ordinal(), so Rank::ordinal and every ordinal-compare
predicate below (is_infraspecific, higher_than, is_family_group, …) reproduce Java’s
behaviour by construction, not by coincidence.
Each constant carries the same code/marker/plural triple as its Java constructor call
— see Rank::code, Rank::marker, Rank::plural. 67 of the 117 are code-restricted
(44 ZOOLOGICAL, 10 BOTANICAL, 7 BACTERIAL, 4 CULTIVARS, 2 VIRUS — counted by
grepping NomCode\. inside Rank.java’s own constant-declaration block, lines 25-311); the
remaining 50 are code-agnostic (None).
#[serde(rename_all = "SCREAMING_SNAKE_CASE")] reproduces Java’s .name() wire form for
every one of the 117, including multi-word constants like SUPERSECTION_BOTANY,
INFRASPECIFIC_NAME and FORMA_SPECIALIS — verified by the exhaustive round-trip test
below (rank_all_117_variants_in_java_declaration_order), so no #[serde(rename = "…")]
overrides were needed.
This is the crate’s single source of truth for rank data and predicates: the ordinal
predicates here replace the former ad-hoc rank_is_infrageneric_strictly
(pipeline::authorship_split) and rank_is_infraspecific / rank_marker
(pipeline::name_tokens) — both were explicit stand-ins for a not-yet-full Rank; those
two files now call Rank::is_infrageneric_strictly, Rank::is_infraspecific and
Rank::marker directly instead of carrying their own copies.
Variants§
Superdomain
Domain
Subdomain
Infradomain
Empire
Realm
Subrealm
Superkingdom
Kingdom
Subkingdom
Infrakingdom
Superphylum
Phylum
Subphylum
Infraphylum
Parvphylum
Microphylum
Nanophylum
Claudius
Gigaclass
Megaclass
Superclass
Class
Subclass
Infraclass
Subterclass
Parvclass
Superdivision
DivisionZoology
Subdivision
Infradivision
Superlegion
Legion
Sublegion
Infralegion
Megacohort
Supercohort
Cohort
Subcohort
Infracohort
Gigaorder
Magnorder
Grandorder
Mirorder
Superorder
Order
Nanorder
Hypoorder
Minorder
Suborder
Infraorder
Parvorder
SupersectionZoology
SectionZoology
SubsectionZoology
SuperseriesZoology
SeriesZoology
SubseriesZoology
Falanx
Gigafamily
Megafamily
Grandfamily
Superfamily
Epifamily
Family
Subfamily
Infrafamily
Supertribe
Tribe
Subtribe
Infratribe
SupragenericName
Supergenus
Genus
Subgenus
Infragenus
DivisionBotany
SupersectionBotany
SectionBotany
SubsectionBotany
SuperseriesBotany
SeriesBotany
SubseriesBotany
InfragenericName
SpeciesAggregate
Species
InfraspecificName
Grex
Klepton
Subspecies
CultivarGroup
Convariety
InfrasubspecificName
Proles
Natio
Aberration
Morph
Supervariety
Variety
Subvariety
Superform
Form
Subform
Pathovar
Biovar
Chemovar
Morphovar
Phagovar
Serovar
Chemoform
FormaSpecialis
Lusus
Cultivar
Mutatio
Strain
Other
Unranked
Implementations§
Source§impl Rank
impl Rank
Sourcepub const ALL: [Rank; 117]
pub const ALL: [Rank; 117]
All 117 constants, in Java declaration/ordinal order — the Rust equivalent of the
compiler-generated Java Rank.values(), needed since Rust has no built-in enum
reflection. Used internally to build [MAJOR_RANKS]/[AMBIGUOUS_MARKER] and by
this module’s own tests.
Sourcepub const LINNEAN_RANKS: [Rank; 7]
pub const LINNEAN_RANKS: [Rank; 7]
Java Rank.LINNEAN_RANKS (Rank.java:313-324, public): the 7 main Linnean ranks,
ordered. Backs Rank::is_linnean.
Sourcepub fn ordinal(&self) -> usize
pub fn ordinal(&self) -> usize
Java Enum.ordinal() — this rank’s 0-based position in declaration order, i.e. its
index into Rank::ALL. Every ordinal-compare predicate below spells this out
explicitly (self.ordinal() > Rank::Species.ordinal(), …) to mirror each Java method
body line-for-line rather than relying on a derived Ord.
Sourcepub fn code(&self) -> Option<NomCode>
pub fn code(&self) -> Option<NomCode>
Java Rank.getCode() (Rank.java:469-474): the single nomenclatural code a rank
constant is anchored to (set via that constant’s own constructor argument), or
None for a code-agnostic rank (most of them — Rank’s own class doc: “The ranks
listed are code agnostic” unless stated otherwise). Exhaustive match grouped by
code, not a wildcard fallback: a future variant addition gets a compile error here
until it’s assigned a code explicitly. Verified against every one of Rank.java’s
117 constructor calls (67 code-carrying: 44 ZOOLOGICAL, 10 BOTANICAL, 7
BACTERIAL, 4 CULTIVARS, 2 VIRUS; 50 None).
Sourcepub fn is_restricted_to_code(&self) -> Option<NomCode>
pub fn is_restricted_to_code(&self) -> Option<NomCode>
Java Rank.isRestrictedToCode() (Rank.java:590-597, @Deprecated in favour of
getCode(), kept as a plain alias) — ported for call-site parity with any future
port that still names it this way.
Sourcepub fn marker(&self) -> Option<&'static str>
pub fn marker(&self) -> Option<&'static str>
Java Rank.getMarker() (Rank.java:457-459): this rank’s own marker string literal
(e.g. SUBSPECIES -> "subsp."), or None for the 3 constants with no marker at
all (CULTIVAR_GROUP, OTHER, UNRANKED). Exhaustive match, grouped by identical
marker text where Java’s own constants share one (the 7 zoology/botany pairs, e.g.
SECTION_ZOOLOGY/SECTION_BOTANY both "sect.") — verified against every one of
Rank.java’s 117 constructor calls (114 marker-carrying, 3 None).
Sourcepub fn plural(&self) -> Option<&'static str>
pub fn plural(&self) -> Option<&'static str>
Java Rank.getPlural() (Rank.java:465-467): this rank’s plural word — either the
explicit third constructor argument, or (when a rank has a marker but no explicit
plural) Java’s own default rank.name().toLowerCase() + "s" computed once and
transcribed here literally. That default is applied VERBATIM even where it reads
oddly (e.g. DIVISION_ZOOLOGY -> "division_zoologys", SECTION_BOTANY ->
"section_botanys" — the Java default never strips the constant’s own _ word
separators before appending "s") — faithful port, not a fix. None for the same 3
markerless constants as Rank::marker (a rank’s plural field is only ever set
alongside a marker in every one of Java’s 5 constructors).
Sourcepub fn has_ambiguous_marker(&self) -> bool
pub fn has_ambiguous_marker(&self) -> bool
Java Rank.hasAmbiguousMarker() (Rank.java:461-463). See [AMBIGUOUS_MARKER].
Sourcepub fn not_other_or_unranked(&self) -> bool
pub fn not_other_or_unranked(&self) -> bool
Java Rank.notOtherOrUnranked() (Rank.java:529-531).
Sourcepub fn other_or_unranked(&self) -> bool
pub fn other_or_unranked(&self) -> bool
Java Rank.otherOrUnranked() (Rank.java:533-535).
Sourcepub fn is_infraspecific(&self) -> bool
pub fn is_infraspecific(&self) -> bool
Java Rank.isInfraspecific() (Rank.java:476-481): true for infraspecific ranks,
excluding SPECIES itself.
Sourcepub fn is_infrageneric(&self) -> bool
pub fn is_infrageneric(&self) -> bool
Java Rank.isInfrageneric() (Rank.java:490-495): true for any rank below genus —
also true for species and infraspecific ranks (see Rank::is_infrageneric_strictly
for the narrower, “strictly infrageneric” version).
Sourcepub fn is_infrageneric_strictly(&self) -> bool
pub fn is_infrageneric_strictly(&self) -> bool
Java Rank.isInfragenericStrictly() (Rank.java:497-502): true for real
infrageneric ranks (an infrageneric epithet, strictly below genus and above species
aggregate) — e.g. SUBGENUS, SECTION_BOTANY. Replaces the former ad-hoc
authorship_split::rank_is_infrageneric_strictly.
Sourcepub fn is_linnean(&self) -> bool
pub fn is_linnean(&self) -> bool
Java Rank.isLinnean() (Rank.java:504-514): true for the 7 main Linnean ranks.
Sourcepub fn get_major_rank(&self) -> Rank
pub fn get_major_rank(&self) -> Rank
Java Rank.getMajorRank() (Rank.java:516-523): the major rank (incl. all Linnean
ranks) this rank belongs to, stripping its prefix (e.g. PHYLUM for SUBPHYLUM).
Infraspecific ranks return INFRASPECIFIC_NAME. Ranks that can’t be mapped to a
major rank return themselves — never a sentinel/None (matches Java’s own doc:
“never null”). See [MAJOR_RANKS].
Sourcepub fn is_species_or_below(&self) -> bool
pub fn is_species_or_below(&self) -> bool
Java Rank.isSpeciesOrBelow() (Rank.java:525-527).
Sourcepub fn is_family_group(&self) -> bool
pub fn is_family_group(&self) -> bool
Java Rank.isFamilyGroup() (Rank.java:537-542): true for family-group ranks,
between GIGAFAMILY (inclusive) and GENUS-side SUPRAGENERIC_NAME (exclusive).
Sourcepub fn is_genus_group(&self) -> bool
pub fn is_genus_group(&self) -> bool
Java Rank.isGenusGroup() (Rank.java:544-549): true for genus-group ranks,
between SUPERGENUS (inclusive) and SPECIES_AGGREGATE (exclusive).
Sourcepub fn is_suprageneric(&self) -> bool
pub fn is_suprageneric(&self) -> bool
Java Rank.isSuprageneric() (Rank.java:551-556): true for any rank above genus.
Sourcepub fn is_uncomparable(&self) -> bool
pub fn is_uncomparable(&self) -> bool
Java Rank.isUncomparable() (Rank.java:572-581). See [UNCOMPARABLE_RANKS].
Sourcepub fn higher_than(&self, other: Rank) -> bool
pub fn higher_than(&self, other: Rank) -> bool
Java Rank.higherThan(Rank) (Rank.java:606-613): true if this rank is higher than
other, excluding OTHER/UNRANKED from the comparison (checked on other, not
self — this asymmetry with Rank::lower_than is exactly Java’s own).
Sourcepub fn lower_than(&self, other: Rank) -> bool
pub fn lower_than(&self, other: Rank) -> bool
Java Rank.lowerThan(Rank) (Rank.java:615-622): true if this rank is lower than
other, excluding OTHER/UNRANKED from the comparison (checked on self, not
other — see Rank::higher_than’s doc comment for the same asymmetry).
Source§impl Rank
Phase 3 (FFM binding) additions — purely additive, nothing above this point is touched.
The FFI crate (nameparser-ffi) needs to turn a Java Rank.name() / NomCode.name()
string (received across the C ABI as a plain &str) back into the corresponding enum
variant. Neither Rank nor NomCode derives serde::Deserialize (only Serialize, for
the wire-JSON output direction), so this is a hand-written reverse lookup rather than a
serde_json::from_value round-trip.
impl Rank
Phase 3 (FFM binding) additions — purely additive, nothing above this point is touched.
The FFI crate (nameparser-ffi) needs to turn a Java Rank.name() / NomCode.name()
string (received across the C ABI as a plain &str) back into the corresponding enum
variant. Neither Rank nor NomCode derives serde::Deserialize (only Serialize, for
the wire-JSON output direction), so this is a hand-written reverse lookup rather than a
serde_json::from_value round-trip.
Sourcepub fn from_name(name: &str) -> Option<Rank>
pub fn from_name(name: &str) -> Option<Rank>
Looks up a variant by its serialized SCREAMING_SNAKE name (Java Rank.name()), the
exact inverse of [rank_wire_name] — which itself is built on this type’s own
Serialize impl, so from_name can never silently drift from the wire form it
reverses. A linear scan over all 117 variants; Rank::from_name is only ever called
once per FFI parse call, not in a hot inner loop. Returns None for an unrecognized
name — mirrors Java’s Rank.valueOf(name) throwing IllegalArgumentException, folded
to None/absent here since the FFI caller treats an unrecognized rank hint the same
as an absent one rather than propagating a Java exception type across the C ABI.