NestedStructInitialiser.jl

If this is useful for somebody else, I’ll register it.

From the README:

NestedStructInitialiser exports two functions: parameters helps to explore
nested structures and initialiser creates efficient constructors for nested
structures.

julia> using NestedStructInitialiser, StaticArrays, Unitful
julia> struct A{N}
        b
        c
        t::NTuple{N, Float64}
    end
julia> struct B{T}
        m::T
        n::Float64
        o::Int
    end
julia> struct C{N}
        x::SVector{N, Float64}
    end

julia> p = parameters(A)
A Parameters
Fixed
 none
Free
 b: Any (indeterminable dimensionality)
 c: Any (indeterminable dimensionality)
 t: Tuple{Vararg{Float64,N}} where N (indeterminable dimensionality)

julia> p = parameters(A{2}, b = B{typeof(1.0u"s")}, c = C{2}, o = 42, n = () -> rand())
A{2} Parameters
Fixed
 b = B{Quantity{Float64,𝐓,Unitful.FreeUnits{(s,),𝐓,nothing}}}
 n = #9
 o = 42
 c = C{2}
Free
 m: Quantity{Float64,𝐓,Unitful.FreeUnits{(s,),𝐓,nothing}}
 x: SArray{Tuple{2},Float64,1,2}
 t: Tuple{Float64,Float64}

julia> constructor = initialiser(p)

julia> constructor([1, 2, 3, 4, 5])
A{2}(B{Quantity{Float64,𝐓,Unitful.FreeUnits{(s,),𝐓,nothing}}}(1.0 s, 0.5556739449879704, 42), C{2}([2.0, 3.0]), (4.0, 5.0))