-
Notifications
You must be signed in to change notification settings - Fork 96
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
Design a more ergonomic API. #66
Comments
Here is the way I think we should change the API. Please feel free to comment. I propose to keep the
An input is an incoming message and an optional input value. An output is a list of outgoing messages, a list of log entries and an optional output value. The caller The usual type of state will be the set of four values: a. not initialized (accepting incoming messages and input values), b. initialized (accepting incoming messages and discarding input values), c. terminated (discarding everything), d. error. The state value is a field in the algorithm I think that keeping errors separate from state as in That was the easy part. So, what does it mean for the user of the library? If you use any of the algorithm |
I agree with the plan for the outputs, and I like the idea of replacing multiple booleans (like
I think we would end up only ever calling |
Let's also keep in mind the Rust API guidelines whenever we make changes to the API. |
I created an issue for that: #108. |
The current
DistAlgorithm
trait makes it easy for the caller to forget checkingnext_message
andnext_output
. It would probably be safer to go back to a design wherehandle_message
directly returns a (#[must_use]
?) result that contains the messages and output.We should also consider moving
DistAlgorithm
into the tests. Even if we don't, all the algorithms should at least be usable without it, too.The text was updated successfully, but these errors were encountered: