gdnative icon indicating copy to clipboard operation
gdnative copied to clipboard

VariantArray methods take non mutable references

Open WBosonic opened this issue 6 years ago • 4 comments

I noticed that methods such as set, resize, etc on VariantArray take non-mutable references, is this intentional?

WBosonic avatar Aug 07 '20 19:08 WBosonic

Yes. There is a good article about what the reference types in Rust actually mean: Accurate mental model for Rust's reference types by dtolnay

ghost avatar Aug 08 '20 07:08 ghost

Thanks for the article! So if I understand correctly the reason shared references make sense is because those methods on VariantArray (and other core types) are thread-safe.

WBosonic avatar Aug 08 '20 09:08 WBosonic

Yes. According to the official guidelines these operations are considered thread-safe.

ghost avatar Aug 08 '20 09:08 ghost

Closing because the question is answered.

ghost avatar Aug 08 '20 17:08 ghost