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

db: add setters to BundleBuilder with &mut self #1527

Merged
merged 2 commits into from
Jun 16, 2024

Conversation

tcoratger
Copy link
Contributor

Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

having these is very useful because usually we need to call them conditionally which because slightly ugly with with the consuming builder functions.

can we also add an fn apply{_mut}<F: FnOnce(Self) -> Self>(self, f)

@@ -151,6 +151,61 @@ impl BundleBuilder {
self
}

/// Set address info of BundleState state.
pub fn set_state_address(&mut self, address: Address) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

since this is a builder type, we can return &mut Self on these functions so they can be chained

the existing self functions should then reuse the &mut self ones so we don't duplicate the actual impl

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed, let me know if this is ok for you

@rakita rakita merged commit dd98b3b into bluealloy:main Jun 16, 2024
25 checks passed
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.

None yet

3 participants