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

Refine API for interned labels #1

Merged
merged 9 commits into from
Jul 28, 2023

Conversation

JoJoJet
Copy link

@JoJoJet JoJoJet commented Jul 28, 2023

  • Simplified the Leak trait, and merged StaticRef into it.
  • Interned labels now implement their corresponding label traits, which simplifies their usage heavily.
  • Added the .intern() method to the label traits, which makes interning them more ergonomic. This removes the syntax InternedLabel::from(&label as &dyn Label).

Copy link
Owner

@geieredgar geieredgar left a comment

Choose a reason for hiding this comment

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

I think those are great ergonomics improvements and simplifications for the small cost of making Interner::intern slightly less flexible, so I will go ahead and merge this.

@@ -5,7 +5,7 @@
//! and make comparisons for any type as fast as integers.

use std::{
borrow::{Borrow, Cow},
borrow::Borrow,
Copy link
Owner

Choose a reason for hiding this comment

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

With Interner::intern taking a reference, we don't need to use Borrow anymore, since it is a no-op on references. I will push a commit fixing that after merging this PR.

@geieredgar geieredgar merged commit b9fb74f into geieredgar:interned-labels Jul 28, 2023
@JoJoJet JoJoJet deleted the simple-leak branch September 20, 2023 05:18
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.

2 participants