Closed RuofengX closed 1 month ago
I'm okay adding it behind a feature gate. If you're willing to send a PR, you would need to modify the generator to emit the derive, but I suppose that would be enough.
Be warned though, it's a lot of generated code, and I suspect serde will bloat it even further, which is why I've avoided it so far.
And of course appreciate the compliments :)
Thanks for reply.
I didn't notice such structure is generated. Is that done by grammers-tl-gen
?
I am looking into grammers-tl-gen
module, it works like macros but it directly generate code files. How it works?
The generator is used by grammers-tl-types' build.rs
script.
How often does build.rs
run? Is it just a oneshot task? Or does telegram official often change the tl schema?
So is it possible to simply add #[derive(Serialize, Deserialized)] in generated files?
build.rs
runs when its crate or the dependencies of its crate change. So changing the api.tl
, the generator, or the types package itself, should cause it to re-run.
telegram official often change the tl schema
Pretty regularly, yes. But grabbing the latest api.tl
is a manual task.
I am using this awesome crate in my actual work to gather some useful information from open chats and bots.
I want to save the data to database or just simple json-string, like
grammers_client::types::chat::Chat
grammers_tl_types::types::Message
I found this project seems doesn't support serde, am I right? And if it really not support, why? I noticed that telegram has it's own bytecode ser&de function, but serde is the in-facts standard in rust language. Using serde framework will make this project more flexible.