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

Able to unwrap while using reply with attachment. #658

Merged
merged 2 commits into from
Jan 25, 2024

Conversation

evshary
Copy link
Contributor

@evshary evshary commented Jan 23, 2024

While we add with_attachment after the reply, it returns Result and it's intuitive for users to use unwrap()
https://github.com/eclipse-zenoh/zenoh/blob/main/zenoh/src/queryable.rs#L166
However, ReplyBuilder doesn't implement Debug, so we can't use unwrap()

let replybuilder = query
            .reply(reply)
            .with_attachment(attachment.build())
            .unwrap();  //<----- Error here

Although there are other ways to handle the error (like map_err), I'm just wondering whether it's possible to support Debug for ReplyBuilder.

@Mallets
Copy link
Member

Mallets commented Jan 23, 2024

To me looks ok to add Debug to the ReplyBuilder. Do other builders derive Debug as well? If not I believe any builder should derive Debug. Chiming in @p-avital .

@Mallets Mallets added the enhancement Existing things could work better label Jan 24, 2024
@evshary
Copy link
Contributor Author

evshary commented Jan 25, 2024

OK, let me list the builder:

@Mallets Just have a quick scan on these Builder. I'll add the Debug trait to those which haven't derived Debug trait.
BTW, do you think AttachmentBuilder should also derive Debug trait?

@Mallets
Copy link
Member

Mallets commented Jan 25, 2024

@Mallets Just have a quick scan on these Builder. I'll add the Debug trait to those which haven't derived Debug trait. BTW, do you think AttachmentBuilder should also derive Debug trait?

Yes

@evshary
Copy link
Contributor Author

evshary commented Jan 25, 2024

@Mallets done

@Mallets Mallets merged commit 4f03fc7 into eclipse-zenoh:main Jan 25, 2024
8 checks passed
@evshary evshary deleted the fix_reply_unwrap branch January 25, 2024 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Existing things could work better
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants