Skip to content

Commit c2dd263

Browse files
committed
simplify StructArrays methods
1 parent da6cbe6 commit c2dd263

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

src/parameterized.jl

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,22 +76,17 @@ end
7676
import StructArrays
7777

7878
function StructArrays.staticschema(::Type{P}) where {N,P<:ParameterizedMeasure{N}}
79-
# Get the types from the NamedTuple parameter
8079
par_type = fieldtype(P, :par)
81-
# Use proper type construction for the component types
8280
types = Tuple{(fieldtype(par_type, n) for n in N)...}
83-
# Return NamedTuple type with parameter names
84-
return NamedTuple{N,types}
81+
NamedTuple{N,types}
8582
end
8683

8784
function StructArrays.component(m::ParameterizedMeasure, key::Symbol)
88-
# Extract component from the parameters NamedTuple
89-
return getfield(getfield(m, :par), key)
85+
getfield(getfield(m, :par), key)
9086
end
9187

9288
function StructArrays.createinstance(::Type{P}, args...) where {N,P<:ParameterizedMeasure{N}}
93-
# Create a new ParameterizedMeasure instance from components
94-
return constructorof(P)(NamedTuple{N}(args))
89+
constructorof(P)(NamedTuple{N}(args))
9590
end
9691

9792
###############################################################################

0 commit comments

Comments
 (0)