Skip to content

Implement Deref<Target=str> for Key#1370

Merged
jstarry merged 1 commit intoyewstack:masterfrom
faulesocke:impl-deref-for-key
Jul 4, 2020
Merged

Implement Deref<Target=str> for Key#1370
jstarry merged 1 commit intoyewstack:masterfrom
faulesocke:impl-deref-for-key

Conversation

@faulesocke
Copy link
Contributor

Description

Fixes #1369

Checklist:

  • I have run ./ci/run_stable_checks.sh
  • I have reviewed my own code
  • I have added tests

@faulesocke
Copy link
Contributor Author

I guess tests are not necessary.

impl Deref for Key {
type Target = str;

#[inline]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the advantage of inlining this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't know what I was thinking, but at least it's also in std::Strings impl marked as inline. Should I remove it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess explicitly inlining this might make LLVM do some more optimization work, but I don't think it really matters.

@teymour-aldridge
Copy link
Contributor

IMO it would be nice (but not essential) to have a test for this.

@jstarry jstarry merged commit 34b4f6c into yewstack:master Jul 4, 2020
@jstarry
Copy link
Member

jstarry commented Jul 4, 2020

Looks good to me! I agree that tests aren't essential and the inline is fine

jstarry pushed a commit that referenced this pull request Aug 16, 2020
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.

Impl Deref<Target = str> for yew::virtual_dom::Key

3 participants