1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
/*
* Magba is licensed under The 3-Clause BSD, see LICENSE.
* Copyright 2025 Sira Pornsiriprasert <code@psira.me>
*/
/// Constructs a source composite.
///
/// # Examples
///
/// Declaring a source assembly:
/// ```
/// use magba::sources;
/// use magba::prelude::*;
/// # let cylinder = CylinderMagnet::default();
/// # let cuboid = CuboidMagnet::default();
/// # let dipole = Dipole::default();
/// # let dipole2 = Dipole::default().with_moment([1.0, 0.0, 0.0]);
/// // For assemblies, we use comma-separated arguments.
/// let assembly: SourceAssembly = sources!(cylinder, cuboid, dipole);
/// ```
///
/// Declaring a homogenous source array:
/// ```
/// use magba::sources;
/// use magba::prelude::*;
/// # let dipole = Dipole::default();
/// # let dipole2 = Dipole::default().with_moment([1.0, 0.0, 0.0]);
/// // For arrays, we use bracket syntax.
/// let homogenous_array: SourceArray<Dipole, _> = sources!([dipole, dipole2]);
/// ```
///
/// Declaring a heterogenous source array:
/// ```
/// use magba::sources;
/// use magba::prelude::*;
/// # let cylinder = CylinderMagnet::default();
/// # let cuboid = CuboidMagnet::default();
/// # let dipole = Dipole::default();
/// let heterogenous_array: SourceArray<Magnet, _> =
/// sources!([cylinder.into(), cuboid.into(), dipole.into()]);
/// ```
pub use sources;
/// Constructs an observer composite.
///
/// # Examples
///
/// Declaring a sensor assembly:
/// ```
/// use magba::observers;
/// use magba::prelude::*;
/// # use magba::sensors::hall_effect::*;
/// # let lin_hall = LinearHallSensor::default();
/// # let hall_switch = HallSwitch::default();
/// # let hall_latch = HallLatch::default();
/// // For assemblies, we use comma-separated arguments.
/// let assembly: ObserverAssembly = observers!(lin_hall, hall_switch, hall_latch);
/// ```
///
/// Declaring a homogenous observer array:
/// ```
/// use magba::observers;
/// use magba::prelude::*;
/// # use magba::sensors::hall_effect::*;
/// # let lin_hall = LinearHallSensor::default();
/// # let lin_hall2 = LinearHallSensor::default().with_position([0.0, 1.0, 0.0]);
/// // For arrays, we use bracket syntax.
/// let homogenous_array: ObserverArray<LinearHallSensor, _> = observers!([lin_hall, lin_hall2]);
/// ```
///
/// Declaring a heterogenous observer array:
/// ```
/// use magba::observers;
/// use magba::prelude::*;
/// # use magba::sensors::hall_effect::*;
/// # let lin_hall = LinearHallSensor::default();
/// # let hall_switch = HallSwitch::default();
/// # let hall_latch = HallLatch::default();
/// let heterogenous_array: ObserverArray<ObserverComponent, _> =
/// observers!([lin_hall.into(), hall_switch.into(), hall_latch.into()]);
/// ```
pub use observers;