Skip to content

Conversation

@pranav-bhatt
Copy link
Contributor

@pranav-bhatt pranav-bhatt commented Jun 1, 2020

Exposes the Iterator functionality of Attributes.

Fix #15

Signed-off-by: Pranav Bhatt <adpranavb2000@gmail.com>
Signed-off-by: Pranav Bhatt <adpranavb2000@gmail.com>
Signed-off-by: Pranav Bhatt <adpranavb2000@gmail.com>
Copy link
Member

@slinkydeveloper slinkydeveloper left a comment

Choose a reason for hiding this comment

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

Check out the warnings (run cargo fix and then cargo fmt, so it fixes the imports)

Also, should the iterators implement ExactSizeIterator, since you know straight from the beginning how many attributes you have? If you need the code to calculate the number of attributes, i think you can find it in v1::EventFormatDeserializer

Signed-off-by: Pranav Bhatt <adpranavb2000@gmail.com>
Signed-off-by: Pranav Bhatt <adpranavb2000@gmail.com>
Signed-off-by: Pranav Bhatt <adpranavb2000@gmail.com>
@pranav-bhatt
Copy link
Contributor Author

Check out the warnings (run cargo fix and then cargo fmt, so it fixes the imports)

Also, should the iterators implement ExactSizeIterator, since you know straight from the beginning how many attributes you have? If you need the code to calculate the number of attributes, i think you can find it in v1::EventFormatDeserializer

Would some values being None cause an issue while implementing ExactSizeIterator?

@slinkydeveloper
Copy link
Member

slinkydeveloper commented Jun 4, 2020

Would some values being None cause an issue while implementing ExactSizeIterator?

No because you calculate with a sum (like done in v1::EventFormatSerializer) the exact number of available attributes

Signed-off-by: Pranav Bhatt <adpranavb2000@gmail.com>
Signed-off-by: Pranav Bhatt <adpranavb2000@gmail.com>
@pranav-bhatt pranav-bhatt marked this pull request as ready for review June 5, 2020 11:00
Signed-off-by: Pranav Bhatt <adpranavb2000@gmail.com>
Copy link
Member

@slinkydeveloper slinkydeveloper left a comment

Choose a reason for hiding this comment

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

small nit and we're ready to merge it!

Signed-off-by: Pranav Bhatt <adpranavb2000@gmail.com>
Signed-off-by: Pranav Bhatt <adpranavb2000@gmail.com>
@slinkydeveloper slinkydeveloper merged commit 046fabc into cloudevents:master Jun 5, 2020
@slinkydeveloper slinkydeveloper added this to the 0.2 milestone Jun 5, 2020
@pranav-bhatt pranav-bhatt deleted the expose_iter branch June 5, 2020 18:31
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.

Attributes iterator

2 participants