Skip to main content

Rank

Enum Rank 

Source
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

Source

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.

Source

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.

Source

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.

Source

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).

Source

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.

Source

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).

Source

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).

Source

pub fn has_ambiguous_marker(&self) -> bool

Java Rank.hasAmbiguousMarker() (Rank.java:461-463). See [AMBIGUOUS_MARKER].

Source

pub fn not_other_or_unranked(&self) -> bool

Java Rank.notOtherOrUnranked() (Rank.java:529-531).

Source

pub fn other_or_unranked(&self) -> bool

Java Rank.otherOrUnranked() (Rank.java:533-535).

Source

pub fn is_infraspecific(&self) -> bool

Java Rank.isInfraspecific() (Rank.java:476-481): true for infraspecific ranks, excluding SPECIES itself.

Source

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).

Source

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.

Source

pub fn is_linnean(&self) -> bool

Java Rank.isLinnean() (Rank.java:504-514): true for the 7 main Linnean ranks.

Source

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].

Source

pub fn is_species_or_below(&self) -> bool

Java Rank.isSpeciesOrBelow() (Rank.java:525-527).

Source

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).

Source

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).

Source

pub fn is_suprageneric(&self) -> bool

Java Rank.isSuprageneric() (Rank.java:551-556): true for any rank above genus.

Source

pub fn is_uncomparable(&self) -> bool

Java Rank.isUncomparable() (Rank.java:572-581). See [UNCOMPARABLE_RANKS].

Source

pub fn is_legacy(&self) -> bool

Java Rank.isLegacy() (Rank.java:583-588). See [LEGACY_RANKS].

Source

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).

Source

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.

Source

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.

Trait Implementations§

Source§

impl Clone for Rank

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Rank

Source§

impl Debug for Rank

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Rank

Source§

impl Hash for Rank

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Rank

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for Rank

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Rank

Auto Trait Implementations§

§

impl Freeze for Rank

§

impl RefUnwindSafe for Rank

§

impl Send for Rank

§

impl Sync for Rank

§

impl Unpin for Rank

§

impl UnsafeUnpin for Rank

§

impl UnwindSafe for Rank

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.