Rename num_font_atlases to len. (#9879)

# Objective

Rename the `num_font_atlases` method of `FontAtlasSet` to `len`.

All the function does is return the number of entries in its hashmap and
the unnatural naming only makes it harder to discover.

---

## Changelog

* Renamed the `num_font_atlases` method of `FontAtlasSet` to `len`.

## Migration Guide

The `num_font_atlases` method of `FontAtlasSet` has been renamed to
`len`.
This commit is contained in:
ickshonpe 2023-09-20 20:44:50 +01:00 committed by GitHub
parent e07c427dea
commit 9873c9745b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View file

@ -153,7 +153,13 @@ impl FontAtlasSet {
})
}
pub fn num_font_atlases(&self) -> usize {
/// Returns the number of font atlases in this set
pub fn len(&self) -> usize {
self.font_atlases.len()
}
/// Returns `true` if the font atlas set contains no elements
pub fn is_empty(&self) -> bool {
self.font_atlases.is_empty()
}
}

View file

@ -114,7 +114,7 @@ impl GlyphBrush {
if !text_settings.allow_dynamic_font_size
&& !font_atlas_warning.warned
&& font_atlas_set.num_font_atlases() > text_settings.max_font_atlases.get()
&& font_atlas_set.len() > text_settings.max_font_atlases.get()
{
warn!("warning[B0005]: Number of font atlases has exceeded the maximum of {}. Performance and memory usage may suffer.", text_settings.max_font_atlases.get());
font_atlas_warning.warned = true;