-
Notifications
You must be signed in to change notification settings - Fork 22
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
Add a method to check if a datetime matches an rrule (or rruleset) #81
Comments
The iterator is the only way to generate occurrences and every method just builds on top of the iterator. So I am not sure what you mean by "a lot more efficient with a dedicated method". Can you please elaborate on how you would make a method that is more efficient without using the iterator? EDIT: Oh you probably mean checking if a datetime matches all of the criteria in the rrule? |
This is exactly what I am looking for. |
Basically my problem is this: I want to know if a let in_sequence: bool = rrule.build(dt_start).unwrap().into_iter().find(|val| val == datetime).is_some() I think if this new method is added, the following code should be equivalent to the check above (please correct me if I am mistaken on this point) // New Method `check_match` that checks if datetime matches all criteria of the rrule
rrule.validate(dt_start).unwrap().check_match(datetime) && datetime > dt_start This new What do you think of this proposal? |
I think it is an interesting use-case, one which I haven't thought about before. I don't have too much time these days to implement it, but if you want to give it a try I would be happy to help and merge it when ready. |
Currently this is possible with the iterator, but it could be made a lot more efficient with a dedicated method (and without any of the security concerns that come with the iterator).
The text was updated successfully, but these errors were encountered: