Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing setter convention described in RFC344 #279

Open
duskmoon314 opened this issue May 23, 2024 · 1 comment
Open

Missing setter convention described in RFC344 #279

duskmoon314 opened this issue May 23, 2024 · 1 comment

Comments

@duskmoon314
Copy link

In RFC344, setter is described as:

* A method `set_foo(&self, val: T)` for setting the field. (The `val` argument
  here may take `&T` or some other type, depending on the context.)

This was once added in commit a29a841

However, the current guideline only describes C-GETTER and does not describe how the setter should be named. Given that there are many results when searching for set_ in the std, I assume this is still the naming convention of the setter. search results

Should we add a description, or is this not suggested, and some API should be adjusted?

@duskmoon314
Copy link
Author

I also wonder whether a setter can always be achieved by a mutable getter. That is, is xxx.set_foo(T) equals *xxx.foo_mut() = T?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant