-
-
Notifications
You must be signed in to change notification settings - Fork 271
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
Octocrab doesn't compile with Yew (for me) #224
Comments
Thank you for your issue! I'm afraid AFAICT, there's not much that I can do to fix this issue, as it seems to be an issue with |
Thanks for the prompt response! I'm sad that Octocrab and Yew aren't gonna be friends for a bit, but I get that it's not always easy to get different tools to play nice together. I'm pretty new to Rust and am just working on my project as a way to learning Rust. I have a lot of programming experience, but more in spaces like Java and Clojure. How hard do you feel the migration away from Thanks for your thoughts and work! |
Absolutely, contributions are always welcome and encouraged.
It's fairly straightforward in terms of complexity, as all we're doing is replacing If you want to take this, and you get stuck, or don't understand something, please feel free to post in the issue and I'll try my best to help. I'd recommend looking at |
Thanks – I might have a look at it, but no promises for anything (fast). 😜 In #99 you suggest trying to address this one endpoint or group at a time. Any suggestions on a good "simple" endpoint to start with just so I can convince myself I understand the issues at hand? |
They’re all roughly the same complexity because the code is very simple. Thinking about it now, I would maybe take a different approach of just changing the HTTP methods (e.g. |
Looking at Another option would perhaps be to add a new Thoughts? Preferences? |
I have a similar issue trying to compile to Maybe make the structs themselves part of a different module/crate that can be compiled separately ? Sorry not too quite sure what it possible. |
There is also surf which abstracts different HTTP client implementations behind a common interface. It claims to support wasm environment. |
@XAMPPRocky Now that #297 has been merged, I think it might be possible to support Right now having The main problem is the |
That seems like a bug, we don't use mio directly, so a dependency we're using is incorrectly depending on mio for wasm. |
I was playing around with a similar idea last year. I think to make that work, one would have to implement the |
So right now, it is still not possible to use octocrab with |
Since #591 brought in the feature flag E.g. # Disable default features since default-client is incompatible with WASM targets.
octocrab = { version = "0.39.0", default-features = false, features = [
"follow-redirect",
"retry",
"rustls",
"timeout",
"tracing",
] } However, now we'll need to construct a compatible client that can be used in place of the original default client. I more of less got as far as: let octocrab = octocrab::OctocrabBuilder::new_empty()
.with_service(client)
.with_layer(&BaseUriLayer::new(Uri::from_static(
"https://api.github.com",
)))
.with_layer(&ExtraHeadersLayer::new(Arc::new(vec![(
USER_AGENT,
"octocrab".parse().unwrap(),
)])))
.with_auth(octocrab::auth::Auth::PersonalToken(
api_token.to_owned().into(),
))
.build()?; but still need something to plug in as the Client, and have been failing to find a good solution so far 😅 Has anyone succeeded in this for WASM targets? |
I was hoping to use Octocrab on a Yew-based project that I'm working on, but when I added the octocrab dependency to my
Cargo.toml
file, octocrab failed to compile.I created a small demo app that illustrates the issue: https://github.com/NicMcPhee/octocrab_test This is about the simplest possible Yew app, and if you uncomment the octocrab dependency in
Cargo.toml
and runtrunk serve
, you get a whole pile of compilation errors when it's trying to build the octocrab code (see below).I'm guessing it's some kind of dependency conflict, but I really don't know.
Yew + Octocrab seems like an "obvious" combination, so it was definitely a bummer that this didn't work. Any suggestions or advice would definitely be appreciated.
Rust versions, etc.
rustup show
provides the following output if that's helpful:The error text
The text was updated successfully, but these errors were encountered: