Skip to content

Implementing an Iterator for the Attributes struct #26

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

Merged
merged 57 commits into from
Apr 30, 2020

Conversation

pranav-bhatt
Copy link
Contributor

@pranav-bhatt pranav-bhatt commented Apr 16, 2020

This pull request is meant to implement the Iterator trait on the Attributes struct. It returns an Option<(&str, AttributeValue)> value. The Iterator will skip over any None values encountered in the non-essential fields.

@slinkydeveloper
Copy link
Member

slinkydeveloper commented Apr 16, 2020

when you commit, you need to signoff commits with --signoff. the DCO bot should tell you how to sign all the previous ones.

@slinkydeveloper
Copy link
Member

So now we need the same for attributes struct in v03

@slinkydeveloper
Copy link
Member

Also, every time you commit, don't forget to run cargo fmt

slinkydeveloper and others added 7 commits April 29, 2020 19:54
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
Signed-off-by: Pranav Bhatt <adpranavb2000@gmail.com>
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
Signed-off-by: Pranav Bhatt <adpranavb2000@gmail.com>
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

Co-authored-by: Fabrizio Lazzaretti <fabrizio@lazzaretti.me>
Signed-off-by: Pranav Bhatt <adpranavb2000@gmail.com>
Signed-off-by: Doug Davis <dug@us.ibm.com>
Signed-off-by: Pranav Bhatt <adpranavb2000@gmail.com>
Signed-off-by: Doug Davis <dug@us.ibm.com>
Signed-off-by: Pranav Bhatt <adpranavb2000@gmail.com>
Signed-off-by: Pranav Bhatt <adpranavb2000@gmail.com>
Signed-off-by: Pranav Bhatt <adpranavb2000@gmail.com>

#[test]
fn iterator_test(){
let a = Attributes{
Copy link
Member

Choose a reason for hiding this comment

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

declare as mut

Copy link
Contributor Author

Choose a reason for hiding this comment

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

so even if I do declare as mut, when it gets passed to .into_iter(), it will get initialised to 0 each time, and wont move ahead!

@slinkydeveloper
Copy link
Member

That's good! Now you need to do the same on the v03 attributes

pranav-bhatt and others added 15 commits April 29, 2020 19:59
Signed-off-by: Pranav Bhatt <adpranavb2000@gmail.com>
Signed-off-by: Pranav Bhatt <adpranavb2000@gmail.com>
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
Signed-off-by: Pranav Bhatt <adpranavb2000@gmail.com>
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
Signed-off-by: Pranav Bhatt <adpranavb2000@gmail.com>
* Added String variant to Data

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Started V0.3 work

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Reworked EventDeserializer trait

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Now event parsing works with v1 and changes

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Cargo fmt

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Reorganized test data

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Fixed serde for v03

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Implemented spec version conversion

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* cargo fmt

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

You wrongly remove CONTRIBUTING and README in this pr

@pranav-bhatt pranav-bhatt marked this pull request as ready for review April 30, 2020 12:22
@slinkydeveloper slinkydeveloper marked this pull request as ready for review April 30, 2020 12:25
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.

Please revert the removal of Contributing.md and readme.md with

git fetch upstream
git checkout upstream/master -- CONTRIBUTING.md
git checkout upstream/master -- README.md

(assuming you named this remote with upstream)

@slinkydeveloper
Copy link
Member

Please revert also the .gitignore

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.

Looks good overall, some minor changes needed

Signed-off-by: Pranav Bhatt <adpranavb2000@gmail.com>
Signed-off-by: Pranav Bhatt <adpranavb2000@gmail.com>
Signed-off-by: Pranav Bhatt <adpranavb2000@gmail.com>
@slinkydeveloper slinkydeveloper merged commit 304a2e7 into cloudevents:master Apr 30, 2020
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