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

Add AsStaticRef trait and let derive(AsRefStr) implement AsStaticRef<str> #24

Merged
merged 1 commit into from May 26, 2018

Conversation

lo48576
Copy link
Contributor

@lo48576 lo48576 commented May 23, 2018

This will solve #23.
I'm not sure which name should be used:

  • AsStaticStr::as_static_str(),
  • AsStaticStr::as_str() (<-- current choice),
  • AsStr::as_str().

Additionaly, documentation should be updated (but I didn't)...

@Peternator7
Copy link
Owner

Hey! I appreciate the fix 👍 I think we should keep the symmetry with AsRef<str>.

Either:

  • AsStaticRef::<str>::as_static() <-- preferred
  • AsStaticRef::<str>::as_static_ref()

I will happily make the doc changes once we get this merged 😊

@lo48576
Copy link
Contributor Author

lo48576 commented May 23, 2018

Rebased (onto current master) and amended.

@lo48576 lo48576 changed the title Add AsStaticStr trait and let derive(AsRefStr) implement it Add AsStaticRef trait and let derive(AsRefStr) implement AsStaticRef<str> May 23, 2018
`#[derive(AsRefStr)]` will implement `AsStaticRef<str>`, and it
enables us to get `&'static str` by `AsStaticRef::<str>::as_static()`.

This will solve Peternator7#23.
@Peternator7 Peternator7 merged commit 3988bee into Peternator7:master May 26, 2018
@Peternator7
Copy link
Owner

Merged! I'll try and get this updated on crates.io this weekend.

@lo48576 lo48576 deleted the as-str branch May 30, 2018 06:38
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 this pull request may close these issues.

None yet

2 participants