Skip to content

Commit 4d9c8d4

Browse files
committed
..ah yes, and SimData wrapper type :)
1 parent 8ccf93e commit 4d9c8d4

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

pkg/VoltoMapSim/src/types.jl

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
2+
# Container for the data generated by a neural network simulation.
3+
# See `init_sim` for the actual properties inside.
4+
#
5+
# We use this type instead of using the wrapped NamedTuple directly, so that we don't get
6+
# the huge NamedTuple type signatures in stacktraces, and to use it for typing function
7+
# arguments
8+
struct SimData
9+
data::NamedTuple
10+
end
11+
12+
function Base.getproperty(s::SimData, name::Symbol)
13+
if name == :data
14+
getfield(s, :data) # Avoid recursion
15+
else
16+
getproperty(s.data, name)
17+
end
18+
end
19+
20+
Base.propertynames(s::SimData) = propertynames(s.data) # For autocompletion in Jupyter.

0 commit comments

Comments
 (0)