-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
More idiomatic texture atlas builder #13238
More idiomatic texture atlas builder #13238
Conversation
let mut texture_atlas_builder = TextureAtlasBuilder::default(); | ||
texture_atlas_builder.padding(padding.unwrap_or_default()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can remove this assignment now and chain it together?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let mut texture_atlas_builder = TextureAtlasBuilder::default().padding(padding.unwrap_or_default());
[..]
texture_atlas_builder.add_texture();
let texture_atlas = texture_atlas_builder.build();
Doesn't compile because padding()
returns a borrow, thus dropping TextureAtlasBuilder
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mm, gotcha.
This does feel like a step backwards in the API. Would be a bit of an unfortunate migration for users to need to split up chained calls into separate statements.
Objective
Solution
Changelog
TextureAtlasBuilder::finish()
toTextureAtlasBuilder::build()
&mut Self
instead ofSelf
Migration Guide