easy_callback
Automatic callback data encoding for teloxide.
This crate provides a derive macro for quickly converting a custom
user-defined type to a callback data string and converting a CallbackQuery
back into the corresponding user-defined type, with support for different
serialization implementations.
When encoding, the data is first serialized using the selected implementation and then encoded as a URL-safe, unpadded Base64 string. During decoding, the process is reversed.
Example
This example demonstrates the library's functionality using the count_bot example.
// ...
// Callback enum encoded using postcard
// ...
// ...
async
// ...
Usage
Add the following to your Cargo.toml,
choosing one or more features corresponding to the implementations you want to use:
[]
= { = "1.1.0", =["postcard"] }
Available implementations:
Multiple implementations can be enabled simultaneously if required.
License
This project is licensed under either of
at your option.