I would like to export a struct to variables. Say I have the following struct
struct point
x::Float64
y::Float64
end
and I use it to define a point
A=point(3.0,4.0)
Is there a concise way to extract the components, like
x,y=A
However, this throws the following error
ERROR: MethodError: no method matching iterate(::point)
I am aware that x,y=A.x, A.y works. However, I am looking for little more concise since the structs that I work with contain many fields with long names.
I edited my comment to fix it. The parenthesis are of course necessary, as otherwise it’s equivalent to ending the previous statement (the semicolon) and then normal iterative destructuring.