Guideline request: preferred signature for methods on small Copy types #172
matklad
started this conversation in
API Guidelines
Replies: 1 comment
-
I personally lean more towards |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Often I have small
Copy
types in the API:Every single time I wonder if I should write
fn len(&self) -> u32
orfn len(self) -> u32
. I think there's no major difference between the two, so a guideline would be helpful to avoid constantly thinking about minor differences.&self
:size_of::<Self>
is large&self
which should be irrelevantself
:size_of::<Self>
is comparable to/smaller thanusize
&self
: I almost always type&
automaticallyBeta Was this translation helpful? Give feedback.
All reactions