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

Location set tweaks #16

Merged
merged 14 commits into from
Oct 2, 2023
Merged

Conversation

shumbo
Copy link
Member

@shumbo shumbo commented Oct 1, 2023

This PR makes several adjustments to the ongoing location set project.

Macros

macro_export exports the macro under the root crate. In our case, LocationSet! was qualified as chorus_lib::LocationSet. However, the LocationSet macro should be part of the core module. There is no way to achieve this in the current Rust ecosystem, but the common workaround is to give the macro a different internal name and re-export it from the module. I applied this workaround to LocationSet.

Separate builder structs

This PR separates the builder struct for LocalTransportChannel and TransportConfig.

#14 (comment)

As discussed, if we apply the builder pattern on LocalTransportChannel itself, we have to construct new hashmaps again and again. While this is not a big problem for now, I want to explore other design options.

One option is to create a separate builder struct, accumulate information on that struct, and call build that produces the desired data type at the end. This allows us to have separate code for accumulating information vs. instantiating the final struct.

Because it can be confusing to mix the two styles (calling methods directly on the struct / using the separate builder struct), I changed both LocalTransportChannel and TransportConfig to the latter style.

@shumbo shumbo marked this pull request as ready for review October 1, 2023 12:30
@shumbo shumbo requested a review from ihaveint October 1, 2023 12:35
Copy link
Collaborator

@ihaveint ihaveint left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left some comments. A few places need edits, but a couple of them is up to you to decide.

@shumbo shumbo requested a review from ihaveint October 2, 2023 19:33
Copy link
Collaborator

@ihaveint ihaveint left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be all good now!

@shumbo shumbo merged commit e499079 into shumbo/available-locations Oct 2, 2023
3 checks passed
@shumbo shumbo deleted the available-locations-tweaks branch October 2, 2023 19:43
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

Successfully merging this pull request may close these issues.

2 participants