Skip to content

Should follow RFC #344 regarding getters #158

Open
@rotty

Description

@rotty

Rust RFC #344 tries to establish naming conventions, among other things, for getter/setter APIs, and notes:

The proposed convention for a field foo: T is:

A method foo(&self) -> &T for getting the current value of the field.
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.)

We do not adhere to this convention for

  • PollItem::get_revents(),
  • Message::get_more(),
  • and all the socket options, which also use a get_ prefix. Here, it could be argued that these should not fall under the API convention since they can fail, in most cases.

I think it would make sense to try to adhere to Rust conventions, when applicable, so I propose to strip the get_ prefix, at least for the non-socket-option cases. The socket option API should be re-evaluated in combination with #134.

So, in 0.8.1 or 0.8.2 the get_-prefixed will be deprecated in favor of their non-prefixed version, and on master, the prefixed form will be removed.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions