You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use Rust's typestate pattern for the Connection type.
Advantages:
Compile time guarantees that the state machine cannot get into an invalid state.
Better performance by greatly decreasing condition checking.
Less and cleaner code (due to less nesting and more specialization)
Disadvantages:
The state machine transitions from one type to another. Storing all of them in a container would require either conversion to/from a common type or other approaches such as Box<dyn Any> and downcasting.
Additional Goals:
Besides the advantages mentioned above, the linked PR will target a more thorough analysis and refactor of the overall Connection functionalities and aims to:
deduplicate code
handle memory better by a stricter use of clones (right now they're all over the place)
comment structs and methods
Other ideas:
Restrict a spawned connection to only a certain type of transport (HTTP, Websockets, SSH, etc.)? Should it be allowed for a Connection that's been used over some transport, e.g. HTTP, to switch to a different one? I'd say that should require a different Connection.
The text was updated successfully, but these errors were encountered:
Use Rust's typestate pattern for the
Connection
type.Advantages:
Disadvantages:
Box<dyn Any>
and downcasting.Additional Goals:
Besides the advantages mentioned above, the linked PR will target a more thorough analysis and refactor of the overall Connection functionalities and aims to:
Other ideas:
The text was updated successfully, but these errors were encountered: