Consider the following two FFI structs:
class A < FFI::Struct
layout :data, :int
end
class B < FFI::Struct
layout :nested, A
end
To instantiate them:
a = A.new
b = B.new
Now when I try to assign a to b.nested like this:
b[:nested] = a
I get the following error:
ArgumentError: put not supported for FFI::StructByValue
It seems FFI doesn't allow you to assign using the [] syntax if the nested struct is "nested by value", that is it is not a pointer. If so, how do I then assign a to b.nested?