this post was submitted on 12 Jun 2023
482 points (100.0% liked)
Technology
1928 readers
7 users here now
Rumors, happenings, and innovations in the technology sphere. If it's technological news, it probably belongs here.
Subcommunities on Beehaw:
This community's icon was made by Aaron Schneider, under the CC-BY-NC-SA 4.0 license.
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
No, I phrased that poorly. What I meant is that if you have a struct that has some field (it owns that data), your operations on that data will be methods of that struct, and not some other struct that happens to have a reference to that struct. The latter is something people tend to do in OO languages like Java. In Rust, if a function accesses data, you usually "freshly" borrow from the owner of that data and pass it as argument to that function instead of relying on some "hidden" references somewhere in hidden in an object. Borrows will almost always be short-lived.
I don't know if any of this makes sense, I'm sorry for the bad explanation. It might make more sense if you play with Rust yourself.
Alright, thanks! I have every intention of playing around a bit.