reda_sp/model/components/
mod.rs

1mod basic;
2mod diode;
3mod bjt;
4mod mosfet;
5mod model;
6
7pub use basic::*;
8pub use diode::*;
9pub use bjt::*;
10pub use mosfet::*;
11pub use model::*;
12
13use super::ToSpice;
14
15#[derive(Debug, Clone)]
16pub enum Component {
17    R(Resistor),
18    C(Capacitor),
19    L(Inductor),
20    D(Diode),
21    Q(BJT),
22    M(MosFET),
23}
24
25impl ToSpice for Component {
26    fn to_spice(&self) -> String {
27        match &self {
28            &Self::R(c) => c.to_spice(),
29            &Self::C(c) => c.to_spice(), 
30            &Self::L(c) => c.to_spice(), 
31            &Self::D(c) => c.to_spice(), 
32            &Self::Q(c) => c.to_spice(), 
33            &Self::M(c) => c.to_spice(), 
34        }
35    }
36}