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

std::ascii needs some improvements #7150

Closed
Kimundi opened this issue Jun 15, 2013 · 0 comments
Closed

std::ascii needs some improvements #7150

Kimundi opened this issue Jun 15, 2013 · 0 comments

Comments

@Kimundi
Copy link
Member

Kimundi commented Jun 15, 2013

  • (~str).to_ascii_consume is incorrect, lacks tests.
  • Need a way to go ~[Ascii] -> ~[u8] (both consuming/unconsuming).
  • Naming conventions could be changed: as_ prefix for cheap casts, to_ as prefix for copying to a new one, into_ for moving into a new type.
  • Unsafe versions without safety checks.
bors added a commit that referenced this issue Jun 17, 2013
- Fixed tests
- Added methods
- Renamed casting methods to be shorter
- Added unsafe versions

Closes #7150
@bors bors closed this as completed in c9e7bb7 Jun 17, 2013
flip1995 pushed a commit to flip1995/rust that referenced this issue May 6, 2021
`Conf` macro improvements

changelog: Allow `default_trait_access` in macros

Mainly this is a change to use serde as in [Manually implementing Deserialize for a struct](https://serde.rs/deserialize-struct.html), which opens the door for a cleaner implementation overall.

* Allow `default_trait_access` in macros (tangential, but used in this PR)
* Deserialize into `TryConf { conf, errors }` instead of using a global `ERRORS` variable.
* Improve the `define_Conf!` macro
	* Remove the redundant string literal `(name, "name", ..)`
	* Support deprecated configs with `#[conf_deprecated(message)]`. Message shows in error.
	* Make the default value optional. Use `Default::default()` if omitted.
* Invalid config value error now shows the key (see test output)
* Cleaner `impl Default for Conf` (no `toml::from_str("")`)
flip1995 pushed a commit to flip1995/rust that referenced this issue May 6, 2021
`Conf` macro improvements part 2

changelog: none

Follow-up to rust-lang#7150

I made the default value required again for `define_Conf!` so that it can be parsed by the magic Python. I guess it's just as well for readability.

r? `@flip1995`
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

Successfully merging a pull request may close this issue.

1 participant