mauro3/Parameters.jl

Calling with kwargs

milankl opened this issue · 1 comments

Say I have

using Parameters
@with_kw mutable struct Param
    a::Int = 1
    b::Int = 2
    c::Bool = true
end

which is called in

function RunModel(;kwargs...)
    P = Param(kwargs...)
    # do something else
end

is there a way to empty all the variables from the kwargs into the Paramstruct? I currently get a no method matching error. Hopefully I can just convert the kwargs somehow?

Nevermind, I just forgot the ;

function RunModel(;kwargs...)
    P = Param(;kwargs...)
end