Skip to content
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

Feat custom parser #352

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open

Feat custom parser #352

wants to merge 14 commits into from

Conversation

Totodore
Copy link
Owner

Motivation

Modify the codebase to have a flexible way to handle new parsers.
Close issue #234.

Solution

A new Parse trait with a parser module will contain all the parser implementations.
Each implementations will implement the Parse trait. They will be enumerated in a Parser enum. Therefore the branching on the chosen parsen will be done with static enum dispatch.
The CommonParser will be the default parser as for the official socket.io implementation.

A future improvement might be to have a better and flexible Value type throughout the codebase in order to handle all the different parsers case we might implement. This might also allow the usage of https://docs.rs/serde_json/latest/serde_json/value/struct.RawValue.html for serde_json which would avoid many useless allocations.

socketioxide/src/parser/common.rs Fixed Show fixed Hide fixed
socketioxide/src/packet.rs Fixed Show fixed Hide fixed
socketioxide/src/parser/common.rs Fixed Show fixed Hide fixed
socketioxide/src/parser/common.rs Fixed Show fixed Hide fixed
socketioxide/src/parser/mod.rs Fixed Show fixed Hide fixed
socketioxide/src/parser/mod.rs Fixed Show fixed Hide fixed
socketioxide/src/parser/mod.rs Fixed Show fixed Hide fixed
socketioxide/src/parser/mod.rs Fixed Show fixed Hide fixed
socketioxide/src/client.rs Fixed Show fixed Hide fixed
socketioxide/src/parser/common.rs Fixed Show fixed Hide fixed
@Totodore Totodore added the enhancement New feature or request label Jul 23, 2024
@Totodore Totodore linked an issue Jul 23, 2024 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Custom parser support
1 participant