Skip to content

Commit

Permalink
Use a semantic result type for tag.repeat
Browse files Browse the repository at this point in the history
  • Loading branch information
alpine-alpaca committed Mar 10, 2024
1 parent c83b4e3 commit ba9f5ba
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## Unreleased

- Parse `repeat` property of a tag. [#23]

[#23]: https://github.com/alpine-alpaca/asefile/pull/23

## 0.3.7 - 2023-03-03

- Fix detection of pixel format for other editors (thanks to [@martinezjavier], [#22])
Expand Down
8 changes: 6 additions & 2 deletions src/tags.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::num::NonZeroU32;

use crate::{reader::AseReader, user_data::UserData, AsepriteParseError, Result};

/// A tag is a grouping of one or more frames.
Expand Down Expand Up @@ -36,8 +38,10 @@ impl Tag {
}

/// Repeat count included in the tag.
pub fn repeat(&self) -> u32 {
self.repeat as u32
///
/// `None` if unspecified/not enabled (UI shows infinity symbol).
pub fn repeat(&self) -> Option<NonZeroU32> {
NonZeroU32::new(self.repeat as u32)
}

/// Returns the user data for the tag, if any exists.
Expand Down

0 comments on commit ba9f5ba

Please sign in to comment.