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

Example web_sys/file_upload fails to build with wasm-pack #1087

Closed
1 of 3 tasks
loewenheim opened this issue Apr 17, 2020 · 4 comments
Closed
1 of 3 tasks

Example web_sys/file_upload fails to build with wasm-pack #1087

loewenheim opened this issue Apr 17, 2020 · 4 comments
Labels

Comments

@loewenheim
Copy link
Contributor

loewenheim commented Apr 17, 2020

After fixing two small problems (see #1088), running wasm-pack build in examples/web_sys/file_upload results in

error[E0308]: mismatched types
  --> web_sys/file_upload/src/lib.rs:52:67
   |
52 | ...                   self.reader.read_file_by_chunks(file, callback, 10).unwrap()
   |                                                             ^^^^^^^^ expected enum `std::option::Option`, found enum `yew::services::reader::FileChunk`
   |
   = note: expected struct `yew::callback::Callback<std::option::Option<yew::services::reader::FileChunk>>`
              found struct `yew::callback::Callback<yew::services::reader::FileChunk>`

The type of read_file_by_chunks was changed in d38ce42. I haven’t tried to compile it, but the corresponding std-web example seems to have the exact same problem. Unfortunately, I can’t easily tell what the fix would be.

Environment:

  • Yew version: master

Questionnaire

  • I'm interested in fixing this myself but don't know where to start
  • I would like to fix and I have a solution
  • I don't have time to fix this right now, but maybe later
@teymour-aldridge
Copy link
Contributor

What happens if you wrap callback in a Some?

@loewenheim
Copy link
Contributor Author

That gives me an Option<Callback<FileChunk>> instead of a Callback<Option<FileChunk>>.

@teymour-aldridge
Copy link
Contributor

I think the problem is that the closure passed as the callback argument takes needs to take a parameter of type Option<FileChunk> but currently only takes an parameter of type FileChunk.

@jstarry
Copy link
Member

jstarry commented Apr 23, 2020

This has been fixed here: #1092

@jstarry jstarry closed this as completed Apr 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants