1pub mod collections;
2pub mod ops;
3pub mod regression;
4
5pub use collections::*;
6pub use ops::{Op, OperationMutator, activation_ops, all_ops, math_ops};
7pub use regression::{Accuracy, AccuracyResult, DataSet, Loss, Regression};
8
9use std::fmt::Display;
10use std::ops::Deref;
11
12#[derive(Debug, Clone, PartialEq, Eq, Hash, Copy)]
15pub enum Arity {
16 Zero,
17 Exact(usize),
18 Any,
19}
20
21impl From<usize> for Arity {
22 fn from(value: usize) -> Self {
23 match value {
24 0 => Arity::Zero,
25 n => Arity::Exact(n),
26 }
27 }
28}
29
30impl Deref for Arity {
31 type Target = usize;
32
33 fn deref(&self) -> &Self::Target {
34 match self {
35 Arity::Zero => &0,
36 Arity::Exact(n) => n,
37 Arity::Any => &0,
38 }
39 }
40}
41
42impl Display for Arity {
43 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
44 match self {
45 Arity::Zero => write!(f, "{:<5}", "Zero"),
46 Arity::Exact(n) => write!(f, "{:<5}", n),
47 Arity::Any => write!(f, "{:<5}", "Any"),
48 }
49 }
50}