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

#27 make TxMessage data members public #28

Merged
merged 3 commits into from
Sep 26, 2024

Conversation

HusseinAbdelhamid
Copy link
Contributor

see #27

@HusseinAbdelhamid HusseinAbdelhamid linked an issue Sep 24, 2024 that may be closed by this pull request
Copy link
Member

@marius-meissner marius-meissner left a comment

Choose a reason for hiding this comment

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

I don't think it's worth giving up OOP or stability and security principles just because of tests.
What about just adding getter methods, which return immutable borrows?
This would also have the advantage that these methods may also be helpful outside of tests.

@HusseinAbdelhamid
Copy link
Contributor Author

I don't think it's worth giving up OOP or stability and security principles just because of tests. What about just adding getter methods, which return immutable borrows? This would also have the advantage that these methods may also be helpful outside of tests.

Yes probably a better idea, so as an example to get the buff member we could implement a fn like this:

  pub fn get_payload(&self) -> &Bytes {
        &self.buff
    }

@@ -111,3 +111,15 @@ fn test_payload_greater_than_generic_type_args() {
assert_eq!(message_2_0.unwrap_err(), MessageError::InvalidLength(5));
assert_eq!(message_fd.unwrap_err(), MessageError::InvalidLength(23));
}

#[test]
Copy link
Member

Choose a reason for hiding this comment

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

Even with unit test, nice :) 👍

Copy link
Member

@marius-meissner marius-meissner left a comment

Choose a reason for hiding this comment

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

LGTM

@marius-meissner marius-meissner merged commit 8885078 into main Sep 26, 2024
24 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.

Change TxMessage data members to public
2 participants