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

LayerSet: add retain & remove_empty_layers #285

Merged
merged 4 commits into from
Dec 8, 2022
Merged

LayerSet: add retain & remove_empty_layers #285

merged 4 commits into from
Dec 8, 2022

Conversation

RickyDaMa
Copy link
Collaborator

@RickyDaMa RickyDaMa commented Dec 8, 2022

This is functionality I have a use for and can't implement anywhere except in the library, given layers is a private member of LayerSet

I don't like that with retain I check every layer to see if its name matches the default, but there's no good way (without allocating) to 'skip one and then retain' that I'm aware of

Simple positive test case added for each method

Copy link
Member

@cmyr cmyr left a comment

Choose a reason for hiding this comment

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

looks reasonable, one note inline. :)


/// Removes any layers that contain no glyphs
pub fn remove_empty_layers(&mut self) {
self.retain(|l| !l.is_empty());
Copy link
Member

@cmyr cmyr Dec 8, 2022

Choose a reason for hiding this comment

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

we should probably also guard against the default layer being removed here?

nevermind I get it 😇

Copy link
Member

@cmyr cmyr left a comment

Choose a reason for hiding this comment

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

🚀

@cmyr cmyr merged commit 78fb4a5 into linebender:master Dec 8, 2022
@cmyr
Copy link
Member

cmyr commented Dec 8, 2022

thanks! if you want a new release, feel free to make a PR bumping the version to 0.8.1.

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