Skip to main content

use_biology/
lib.rs

1#![forbid(unsafe_code)]
2#![doc = include_str!("../README.md")]
3
4pub use use_biological_system as biological_system;
5pub use use_cell as cell;
6pub use use_gene as gene;
7pub use use_life_stage as life_stage;
8pub use use_organ as organ;
9pub use use_organism as organism;
10pub use use_reproduction as reproduction;
11pub use use_species as species;
12pub use use_taxonomy as taxonomy;
13pub use use_tissue as tissue;
14pub use use_trait as trait_;
15
16/// Common primitive biology vocabulary reexports.
17pub mod prelude {
18    pub use use_biological_system::{
19        BiologicalSystem, BiologicalSystemKind, BiologicalSystemKindParseError,
20        BiologicalSystemNameError,
21    };
22    pub use use_cell::{
23        CellKind, CellKindParseError, CellNameError, CellOrganelle, CellOrganelleParseError,
24        CellStructure, CellType,
25    };
26    pub use use_gene::{Allele, GeneId, GeneName, GeneSymbol, GeneValueError, Genotype, Locus};
27    pub use use_life_stage::{
28        DevelopmentStage, DevelopmentStageError, LifeStage, LifeStageParseError,
29    };
30    pub use use_organ::{
31        OrganKind, OrganKindParseError, OrganName, OrganNameError, OrganSystemRef,
32    };
33    pub use use_organism::{
34        OrganismClassification, OrganismId, OrganismKind, OrganismKindParseError, OrganismName,
35        OrganismNameError,
36    };
37    pub use use_reproduction::{
38        FertilizationMode, FertilizationModeParseError, ReproductionMode,
39        ReproductionModeParseError,
40    };
41    pub use use_species::{
42        BinomialName, GenusName, SpeciesName, SpeciesNameError, SpecificEpithet,
43        SubspecificEpithet, TrinomialName,
44    };
45    pub use use_taxonomy::{
46        CommonName, ScientificName, Taxon, TaxonName, TaxonomicLineage, TaxonomicRank,
47        TaxonomicRankParseError, TaxonomyNameError,
48    };
49    pub use use_tissue::{TissueKind, TissueKindParseError, TissueName, TissueNameError};
50    pub use use_trait::{
51        Phenotype, TraitKind, TraitKindParseError, TraitName, TraitNameError, TraitValue,
52    };
53}
54
55#[cfg(test)]
56mod tests {
57    use super::prelude::{
58        BinomialName, CellKind, GeneSymbol, GenusName, LifeStage, OrganismKind, SpecificEpithet,
59        TaxonomicRank, TraitKind, TraitName, TraitValue,
60    };
61
62    #[test]
63    fn facade_composes_biology_primitives_without_analysis() {
64        let rank = TaxonomicRank::Species;
65        let species = BinomialName::new(
66            GenusName::new("Homo").expect("valid genus"),
67            SpecificEpithet::new("sapiens").expect("valid epithet"),
68        );
69        let organism_kind = OrganismKind::Animal;
70        let cell_kind = CellKind::Eukaryotic;
71        let gene_symbol = GeneSymbol::new("BRCA1").expect("valid symbol");
72        let trait_value =
73            TraitValue::new(TraitName::new("eye color").expect("valid trait"), "brown")
74                .expect("valid trait value")
75                .with_kind(TraitKind::Morphological);
76        let life_stage = LifeStage::Adult;
77
78        assert_eq!(rank.to_string(), "species");
79        assert_eq!(species.to_string(), "Homo sapiens");
80        assert_eq!(organism_kind.to_string(), "animal");
81        assert_eq!(cell_kind.to_string(), "eukaryotic");
82        assert_eq!(gene_symbol.to_string(), "BRCA1");
83        assert_eq!(trait_value.value(), "brown");
84        assert_eq!(trait_value.kind(), Some(&TraitKind::Morphological));
85        assert_eq!(life_stage.to_string(), "adult");
86    }
87}