Skip to content
New issue

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

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

Already on GitHub? # to your account

rename Bytes::as_string() to to_string(), as_vector() to to_vector() #334

Open
milyin opened this issue Dec 18, 2024 · 0 comments
Open

rename Bytes::as_string() to to_string(), as_vector() to to_vector() #334

milyin opened this issue Dec 18, 2024 · 0 comments
Labels
release Part of the next release

Comments

@milyin
Copy link
Contributor

milyin commented Dec 18, 2024

Describe the release item

The as_ prefix supposes that the returned value still references to the original owner. E.g. KeyExpr::as_string_view is completely correct as the string view is just a refernence to value which contained in KeyExpt. On the other hand the to_ prefix supposes transferring the ownership. E.g. Config::to_string() creates new std::string object.

So normally the as_string and as_vector should be to_string and to_vector.

The proposal is:

  • add methods to_string and to_vector to Bytes
  • keep as_string and as_vector as the API is already stabilized, but mark them as deprecated and remove them from the documentation
  • do all necessary renaming in the examples/tests
@milyin milyin added the release Part of the next release label Dec 18, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
release Part of the next release
Projects
Status: No status
Development

No branches or pull requests

1 participant