Best way to make a struct of CollectionElements to conform to CollectionElement.
I am still confused about best practices for
__moveinit__
and __copyinit__
.
Let's say i have a struct with two variables, which are both structs which conform to the CollectionElement
trait, how to define __moveinit__
and __copyinit__
for this struct.
Will this do?
Any advice highly appreciated2 Replies
Unless you're doing anything special this should work just fine. moveinit and copyinits like this are so common that it's why we have
@value
. Almost every struct I write uses the value decorator.sometimes I see in the moveinit a caret ^ symbol at the end of the assignment.
Does that mean copy the address instead of the value? If so, why not do this for all the fields? Is it something to do with primitive types?
nm, found the answer about ^ here: https://discord.com/channels/1087530497313357884/1247713442190721114/1247715698092802119