Skip to content

Conversation

@haerdib
Copy link
Contributor

@haerdib haerdib commented Nov 27, 2023

Fixes the compile errors of standalone features. The following was changed:

  • Added additional CI checks
  • Added futures-util to default import because the async code needs it to compile. Because the sync code does not, I only added the minimum needed package (which is -util and not the full futures).
  • tungstenite-client and ws-client now include the sync-api feature, because they are only work in sync mode anyway.
  • fixed async no-std compiliation by adding #[cfg(not(feature = "sync-api"))] use alloc::boxed::Box; : async-trait automatically changes async return values into boxed values.

closes #644

@haerdib haerdib self-assigned this Nov 27, 2023
@haerdib haerdib added F2-bug Something isn't working E2-breaksapi labels Nov 28, 2023
@haerdib haerdib requested a review from Niederb November 28, 2023 08:24
@haerdib haerdib marked this pull request as ready for review November 28, 2023 08:24
Copy link
Contributor

@Niederb Niederb left a comment

Choose a reason for hiding this comment

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

I don't quite understand why the changes with Box are needed. I assume you had compilation errors. Can you tell me how I can reproduce them?

#[cfg(not(feature = "sync-api"))]
use alloc::boxed::Box;

@haerdib
Copy link
Contributor Author

haerdib commented Nov 28, 2023

See the PR description:

  • Fixed async no-std compiliation by adding #[cfg(not(feature = "sync-api"))] use alloc::boxed::Box; : async-trait automatically changes async return values into boxed values.

For reproducing: Simply remove the use alloc::boxed::Box; and run cargo check --no-default-features

Copy link
Contributor

@Niederb Niederb left a comment

Choose a reason for hiding this comment

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

Now I understood. Thanks

@haerdib haerdib merged commit e58919a into master Nov 28, 2023
@haerdib haerdib deleted the bh/644-fix-compile-errors branch November 28, 2023 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

E2-breaksapi F2-bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cargo check --no-default-features --features std,tungstenite results in compiler error

3 participants