Skip to content

Commit

Permalink
Add len and is_empty method to attributes (#377)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dekkonot authored Nov 21, 2023
1 parent 1257a0d commit e9732e4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions rbx_types/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# rbx_types Changelog

## Unreleased Changes
* Add `len` and `is_empty` methods to `Attributes` struct. ([#377])

## 1.7.0 (2023-10-03)
* Implemented `FromStr` for `TerrainMaterials`. ([#354])
Expand All @@ -12,6 +13,7 @@
[#355]: https://github.com/rojo-rbx/rbx-dom/pull/355
[#358]: https://github.com/rojo-rbx/rbx-dom/pull/358
[#363]: https://github.com/rojo-rbx/rbx-dom/pull/363
[#377]: https://github.com/rojo-rbx/rbx-dom/pull/377

## 1.6.0 (2023-08-09)
* Added support for `UniqueId` values. ([#271])
Expand Down
12 changes: 12 additions & 0 deletions rbx_types/src/attributes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,18 @@ impl Attributes {
pub fn iter(&self) -> impl Iterator<Item = (&String, &Variant)> {
self.data.iter()
}

/// Returns the number of attributes.
#[inline]
pub fn len(&self) -> usize {
self.data.len()
}

/// Returns true if the struct contains no attributes.
#[inline]
pub fn is_empty(&self) -> bool {
self.data.is_empty()
}
}

impl IntoIterator for Attributes {
Expand Down

0 comments on commit e9732e4

Please sign in to comment.