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

Fix compile error when target is wasm and multipart feature is enabled. #1296

Merged
merged 5 commits into from
Jul 1, 2021

Conversation

Saruniks
Copy link
Contributor

This PR aims to close #1295.

Without this fix master (and v0.11.4) fails to compile with this command:
cargo build --target wasm32-unknown-unknown --features multipart

@seanmonstar Your initial suggestion was to remove #[derive(Clone)] from enum Inner, and change clone() method to try_clone() that matches on the inner type.

But after some research I found out that clone could be implemented for both Inner::Bytes and Inner::Multipart with minimal changes. (I added several #[derive(Clone)] attributes)

What do you think about this change? I am open to implementing your initial suggestion.

I am open to feedback and I will address comments asap.

src/wasm/body.rs Outdated Show resolved Hide resolved
src/wasm/multipart.rs Outdated Show resolved Hide resolved
@Saruniks
Copy link
Contributor Author

Thanks for the review. I will make fixes asap if the problem is not solved by that time.

@Saruniks
Copy link
Contributor Author

So far what I managed to do was to fix compile error without exposing clone(). But there's one catch that if Inner type is Inner::Multipart(_) then try_clone returns None.

I have spent some time trying to implement clone to Inner::Multipart(_). But I didn't find a way do it yet without exposing clone() methods to public interface.

Copy link
Owner

@seanmonstar seanmonstar left a comment

Choose a reason for hiding this comment

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

What you have now looks right to me, thanks!

@seanmonstar seanmonstar merged commit e6a1a09 into seanmonstar:master Jul 1, 2021
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.

v0.11.4 compile error wasm target
3 participants