Skip to content

Refine API for interned labels#1

Merged
geieredgar merged 9 commits intogeieredgar:interned-labelsfrom
joseph-gio:simple-leak
Jul 28, 2023
Merged

Refine API for interned labels#1
geieredgar merged 9 commits intogeieredgar:interned-labelsfrom
joseph-gio:simple-leak

Conversation

@joseph-gio
Copy link
Copy Markdown

  • 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
Copy Markdown
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.


use std::{
borrow::{Borrow, Cow},
borrow::Borrow,
Copy link
Copy Markdown
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
@joseph-gio joseph-gio 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