How to understand Flux.functor?

Dear Community, I got a question about functor usage in Flux.jl. When I read the DQN code in ReinforcementLearningZoo, I confused the usage of the functor:

Flux.functor(x::DQNLearner) = (Q = x.approximator, Qₜ = x.target_approximator),
y -> begin
    x = @set x.approximator = y.Q
    x = @set x.target_approximator = y.Qₜ
    x
end

Can someone answer my doubts?

The best place to read about functors is the Functors.jl README. The models in ReinforcementLearningZoo don’t use the macro, but hook into the underlying API and overload Functors.functor for more flexibility over how their structs are reconstructed. Also note that the @set macro and syntax does not come from Functors, but from GitHub - jw3126/Setfield.jl: Update deeply nested immutable structs..

Thank you very much!