#[allow(unused_imports)]
use alloc::{boxed::Box, format, string::String, string::ToString, vec, vec::Vec};
use crate::category::ConnectionGenerators;
use crate::logic::axiom::Axiom;
use crate::ontology::Vocabulary;
use crate::ontology::meta::Provenance;
pub type BoxedAxiom = Box<dyn Axiom>;
pub fn boxed_axiom<A: Axiom + 'static>(a: A) -> BoxedAxiom {
Box::new(a)
}
#[cfg(not(target_arch = "wasm32"))]
#[linkme::distributed_slice]
pub static VOCABULARIES: [fn() -> Vocabulary];
#[cfg(not(target_arch = "wasm32"))]
#[linkme::distributed_slice]
pub static AXIOMS: [fn() -> Provenance];
#[cfg(not(target_arch = "wasm32"))]
#[linkme::distributed_slice]
pub static AXIOM_CONSTRUCTORS: [fn() -> BoxedAxiom];
#[cfg(not(target_arch = "wasm32"))]
#[linkme::distributed_slice]
pub static FUNCTORS: [fn() -> Provenance];
#[cfg(not(target_arch = "wasm32"))]
#[linkme::distributed_slice]
pub static ADJUNCTIONS: [fn() -> Provenance];
#[cfg(not(target_arch = "wasm32"))]
#[linkme::distributed_slice]
pub static NATURAL_TRANSFORMATIONS: [fn() -> Provenance];
#[cfg(not(target_arch = "wasm32"))]
#[linkme::distributed_slice]
pub static FUNCTOR_CONSTRUCTORS: [fn() -> ConnectionGenerators];
#[cfg(not(target_arch = "wasm32"))]
#[linkme::distributed_slice]
pub static ADJUNCTION_CONSTRUCTORS: [fn() -> ConnectionGenerators];
#[cfg(not(target_arch = "wasm32"))]
#[linkme::distributed_slice]
pub static NATURAL_TRANSFORMATION_CONSTRUCTORS: [fn() -> ConnectionGenerators];
#[cfg(not(target_arch = "wasm32"))]
pub fn describe_knowledge_base() -> Vec<Vocabulary> {
VOCABULARIES.iter().map(|f| f()).collect()
}
#[cfg(target_arch = "wasm32")]
pub fn describe_knowledge_base() -> Vec<Vocabulary> {
Vec::new()
}
#[cfg(not(target_arch = "wasm32"))]
pub fn describe_axioms() -> Vec<Provenance> {
AXIOMS.iter().map(|f| f()).collect()
}
#[cfg(target_arch = "wasm32")]
pub fn describe_axioms() -> Vec<Provenance> {
Vec::new()
}
#[cfg(not(target_arch = "wasm32"))]
pub fn axiom_constructors() -> Vec<BoxedAxiom> {
AXIOM_CONSTRUCTORS.iter().map(|f| f()).collect()
}
#[cfg(target_arch = "wasm32")]
pub fn axiom_constructors() -> Vec<BoxedAxiom> {
Vec::new()
}
#[cfg(not(target_arch = "wasm32"))]
pub fn axiom_by_name(name: &str) -> Option<BoxedAxiom> {
AXIOM_CONSTRUCTORS
.iter()
.map(|f| f())
.find(|a| a.name() == *name)
}
#[cfg(target_arch = "wasm32")]
pub fn axiom_by_name(_name: &str) -> Option<BoxedAxiom> {
None
}
#[cfg(not(target_arch = "wasm32"))]
pub fn describe_functors() -> Vec<Provenance> {
FUNCTORS.iter().map(|f| f()).collect()
}
#[cfg(target_arch = "wasm32")]
pub fn describe_functors() -> Vec<Provenance> {
Vec::new()
}
#[cfg(not(target_arch = "wasm32"))]
pub fn describe_adjunctions() -> Vec<Provenance> {
ADJUNCTIONS.iter().map(|f| f()).collect()
}
#[cfg(target_arch = "wasm32")]
pub fn describe_adjunctions() -> Vec<Provenance> {
Vec::new()
}
#[cfg(not(target_arch = "wasm32"))]
pub fn describe_natural_transformations() -> Vec<Provenance> {
NATURAL_TRANSFORMATIONS.iter().map(|f| f()).collect()
}
#[cfg(target_arch = "wasm32")]
pub fn describe_natural_transformations() -> Vec<Provenance> {
Vec::new()
}
#[cfg(not(target_arch = "wasm32"))]
pub fn connection_constructors() -> Vec<ConnectionGenerators> {
let mut all: Vec<ConnectionGenerators> = FUNCTOR_CONSTRUCTORS.iter().map(|f| f()).collect();
all.extend(ADJUNCTION_CONSTRUCTORS.iter().map(|f| f()));
all.extend(NATURAL_TRANSFORMATION_CONSTRUCTORS.iter().map(|f| f()));
all
}
#[cfg(target_arch = "wasm32")]
pub fn connection_constructors() -> Vec<ConnectionGenerators> {
Vec::new()
}
pub fn describe_all_arrows() -> Vec<Provenance> {
let mut arrows = describe_functors();
arrows.extend(describe_adjunctions());
arrows.extend(describe_natural_transformations());
arrows
}
#[cfg(all(test, not(target_arch = "wasm32")))]
mod tests {
use super::*;
#[test]
fn registry_is_accessible() {
let _ = describe_knowledge_base().len();
let _ = describe_axioms().len();
let _ = describe_functors().len();
let _ = describe_adjunctions().len();
let _ = describe_natural_transformations().len();
}
}