-
Notifications
You must be signed in to change notification settings - Fork 34
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
Event.get_uid() doesn't work when event is constructed from builder functions #110
Comments
Yes the default behavior right now is that you have to set that yourself. I was thinking for a bit what could be a safe default to generate a UID from something in the event data but haven't found a good approach yet. Also the lib can't just gehst generate a random uuid either, since you'd get a different uid for the same event every time you regenerate the calendar. So at the moment the crate leaves it to the user to fill out the uid. |
that's fair. the weird thing really is that if you debug the string created by &Event.to_string(), it does have a uid there. So I imagine something somewhere is creating this uid, but I haven't looked at the codebase enough to figure out where that's coming from. Any ideas? |
yes, actually in the serialization we check if there is a UID and if not we create a UUID to fill it.
So we generate one at serialization time. I'm not super happy with this approach, but it is probably sufficient for a one time generation. But if you serve an iCalendar you will want to generate them yourself in order to get a stable UID. If you have a better idea please let me know. |
This can probably be solved by seperating the builder as in #35! Then you can use the user supplied UID or generate one when Optionally, there could be an |
When an event is constructed as follows:
the debug clearly shows the event body as having a UID. However:
let event_uid = event.get_uid().unwrap();
This panics. I'd assume setting the uid manually with uid() would work, but I don't want to do this. Perhaps I'm doing something wrong here, which of course I'm open to, but this doesn't seem like intended functionality.
edit: looks like the UID property isn't getting populated at all on event creation - event.properties() doesn't have UID and event.property_value("UID").unwrap() panics too.
The text was updated successfully, but these errors were encountered: