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
The ConnectionEnd::versions getter method clones the versions vector. I think it would make more sense to have this method not allocate and return a &’a [Versions] instead.
Problem Definition
Getter methods in Rust typically return a reference. It’s not explicit in the ConnectionEnd::versions method that it is allocating, so these calls are more expensive than they might seem.
Proposal
It looks like it would be pretty straightforward to change the method to return a slice, as well as convert any downstream calls to the method to accept a &'a [Version] instead. Some call sites will require a .to_vec to get back an owned vector, but I think it makes more sense to do that than to have the versions getter method return an owned vector.
Acceptance Criteria
ConnectionEnd::versions returns a &’a [Versions] and any code calling this method is revised to accept this type as input.
For Admin Use
Not duplicate issue
Appropriate labels applied
Appropriate milestone (priority) applied
Appropriate contributors tagged
Contributor assigned/self-assigned
The text was updated successfully, but these errors were encountered:
Crate
ibc-relayer
Summary
The
ConnectionEnd::versions
getter method clones theversions
vector. I think it would make more sense to have this method not allocate and return a&’a [Versions]
instead.Problem Definition
Getter methods in Rust typically return a reference. It’s not explicit in the
ConnectionEnd::versions
method that it is allocating, so these calls are more expensive than they might seem.Proposal
It looks like it would be pretty straightforward to change the method to return a slice, as well as convert any downstream calls to the method to accept a
&'a [Version]
instead. Some call sites will require a.to_vec
to get back an owned vector, but I think it makes more sense to do that than to have the versions getter method return an owned vector.Acceptance Criteria
ConnectionEnd::versions
returns a&’a [Versions]
and any code calling this method is revised to accept this type as input.For Admin Use
The text was updated successfully, but these errors were encountered: