-
Notifications
You must be signed in to change notification settings - Fork 1
Storable events #8
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
base: main
Are you sure you want to change the base?
Conversation
@tyranron Found a problem with #[automatically_derived]
impl<'__raw, __Data> TryFrom<Raw<'__raw, __Data, ()>> for Event
where
FileEvent: TryFrom<Raw<'__raw, __Data, ()>>,
ChatEvent: TryFrom<
Raw<'__raw, __Data, ()>,
Error = <FileEvent as TryFrom<Raw<'__raw, __Data, ()>>::Error
>
{
type Error = FromRawError<<FileEvent as TryFrom<__Data>>::Error, ()>;
fn try_from(raw: Raw<'__raw, __Data, ()>) -> Result<Self, Self::Error> {
for (_, var_name, var_rev) in <FileEvent as codegen::Reflect>::META {
if var_name == raw.name && var_rev == raw.rev { // Can't compare because `Reflect` hold values as strings.
return <FileEvent as TryFrom<__Data>>::try_from(raw.data)
.map(Self::File)
.map_err(FromRawError::FromDataError);
}
}
/* check ChatEvent */
Err(FromRawError::UnknownEvent {
name: raw.name.to_string(),
revision: raw.revision,
})
}
} Possible solutions:
|
@50U10FCA7 as the code is generated, I think we may go with string conversion. |
@tyranron Maybe we should block duplicated variants in enums, because it drives ambiguous behaviour. #[derive(Event)]
enum MyEvent {
#[event(init)]
Init(SomethingHappened),
NotInit(SomethingHappened),
} Once enum from example above is deserialized/converted from raw it always be init. Alternatively we can error in cases when duplicated variants have different |
Discussed: Type-level doesn't allows to use such Type-check recursion when expanding from/into
|
Found an alternative to current discussed design of the |
Synopsis
Storing events in repository.
Solution
Implement wrapper around
Event
containing metadata needed to determine event.Checklist
k::
labels applied