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

Feature/cycle event limit #21

Merged
merged 4 commits into from
Jun 14, 2024
Merged

Feature/cycle event limit #21

merged 4 commits into from
Jun 14, 2024

Conversation

unlessgames
Copy link
Collaborator

@unlessgames unlessgames commented Jun 13, 2024

Implementing #9

Cycle::generate now returns a Result that fails if the output exceeds the limit defined for the Cycle (currently 0x1000).

I changed the files that used Cycle::generate to avoid errors (they just output no events in case of a fail), but I suppose the error should be propagated up to the user. I could look into this but maybe it's best if you implement the rest of this however you want.

@unlessgames unlessgames requested a review from emuell June 13, 2024 21:39
emuell added 2 commits June 14, 2024 08:49
- panic in the plain rust cycle event iter
- set a lua callback error in the scripted cycle event iter
-  to ease constructing it and to add a constant for the event limit default
- to avoid passing "None" for seeds all the time
@emuell
Copy link
Owner

emuell commented Jun 14, 2024

I've changed things to

  • let the simple rust event iter panic (the one that is only used with scripting disabled)
  • let the lua rhythm event iter spit out a lua runtime error. this will abort/stop the script in clients.

In the last commit I also changed the default argument handling in Cycle with two new "with_" functions. Unfortunately there are no default argument values in Rust functions and various ways to handle this. I like this one and use it as a pattern throughout this crate. If you dislike it or think it is off topic, I can remove the last commit again.

@unlessgames
Copy link
Collaborator Author

I like it!

@unlessgames unlessgames merged commit 685ebe4 into master Jun 14, 2024
1 check passed
@unlessgames unlessgames deleted the feature/cycle-event-limit branch June 14, 2024 07:46
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