d47081
October 29, 2024, 6:44pm
1
I'm beginner in Rust, and can't understand from documentation
if I make Byte.clone()
for Bytes - it will create just new pointer, not entire bytes slice?
same for GString.clone()
(GString )
both should be shared pointers with data stored on heap, so I can clone
them without worry to take extra space in memory, or must I use reference to these objects instead?
Maybe somebody have experience in GTK and can simply reply for this newbie question
d47081
October 29, 2024, 7:06pm
3
So GString.clone()
make the copy of data with same method name (where clone for Bytes makes just reference with counter increased), right?
Yes. I don't see a glib-specific way of sharing GStrings, but I have no glib experience. Wrapping it in a Rust Arc would work.
2 Likes
d47081
October 29, 2024, 7:25pm
5
Thanks for answer, I've read about GSrings once but for some reasons returned again with doubts, because lot of gobjects already shared references
1 Like
system
Closed
January 27, 2025, 7:26pm
6
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.