You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've started looking at the code and I think that e.g. in main event loop for FetcherResponse::FiberDump event to pub fn replace_fiber_dump we could pass &Vec<T> or even just slice &[T](according to reddit comment) as we don't mutate those Fiber structs but only traverse it for creating tree and retrieving label & dump strings. [EDIT] Right now I think that in this case it doesn't matter as it's the only thing happening to those Vectors.
And the same for tree_list_widget and list_tree_nodes for passing references without ownership as format! accepts &str so we don't need to pass an owned variant.
(I see that in this snippet we end up creating number of copies, like for fib_labels)
Then we don't need to instantiate UIFibers with label and dump copies which are then retrieved in the next lines.
At the end append method for Vec accepts a reference which gets emptied there so it think whole replacing fiber dump could be done without copying label and dump strings with clone() and to_owned().
As I understand we use String if we plan to append/change ownership it and for immutable content access we should only pass &str and slices &[T] (although slice can be mut).
WDYT? I might got it wrong completely.
No description provided.
The text was updated successfully, but these errors were encountered: