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

Add builder APIs #17

Open
vincentdephily opened this issue Oct 25, 2019 · 0 comments
Open

Add builder APIs #17

vincentdephily opened this issue Oct 25, 2019 · 0 comments

Comments

@vincentdephily
Copy link
Collaborator

Currently, Packet construction can only be done by filling every field, which is neat but a bit wordy:

let pkt = Connect { protocol: Protocol::MQTT311,
                        keep_alive: 60,
                        client_id: "foo".into(),
                        clean_session: true,
                        last_will: None,
                        username: None,
                        password: None };

It'd be nice to have [#derive(Default)] or impl fn new() -> Self and a full set of fn set_clientid(self, String) -> Self.

Just need to make sure that packets have reasonable defaults (provide a new() with arguments otherwise) and that using these API don't cause extra allocations.

It might also be a good time to get a closer look at MQTT5 to see how mqttrs will transistion to supporting both.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant