ehttp::Mode is not available on native targets, causing compilation errors
还没有人认领这个 Issue。
评估
调研方向
从 ehttp/lib.rs 中的 types 模块附近以及第 80 行附近注明的条件编译开始。在 native target 上编译提供的 Request 构造,然后也检查 WASM target。完成的标准是可以导入 ehttp::Mode,并且 Request 能够在 native 和 WASM32 target 上编译。
由索引模型根据 Issue 内容生成。
描述
Description
In the latest release, the mode field was added to ehttp::Request on native targets as well (likely to unify the API). However, the ehttp::Mode enum itself seems to still be gated behind #[cfg(target_arch = "wasm32")].
As a result, it is currently impossible to construct an ehttp::Request manually or specify the mode on non-WASM targets, because ehttp::Mode cannot be imported.
Reproduction Code
Trying to compile the following code on a native target (e.g., Linux/macOS/Windows) results in an error:
impl LoginCredentials {
fn login_request(&self, frame: &mut eframe::Frame) -> ehttp::Request {
ehttp::Request {
method: HttpMethod::Post.into(),
url: get_url(Path::Token, frame),
body: format!(
"&username={}&password={}",
self.username, self.password,
)
.into(),
headers: ehttp::Headers::new(&[
("Accept", ContentType::ApplicationJson.as_str()),
(
"Content-Type",
ContentType::ApplicationXWwwFormUrlencoded.as_str(),
),
]),
#[cfg(target_arch = "wasm32")]
mode: ehttp::Mode::default(),
timeout: None,
}
}
}
Relevant Code Location
It seems the visibility of the module or the enum definition needs to be updated. I believe the issue is located here where types might be conditionally compiled or the Mode enum inside it is restricted: https://docs.rs/ehttp/latest/src/ehttp/lib.rs.html#80
Expected Behavior
ehttp::Mode should be available on all targets (Native and WASM) since ehttp::Request now requires it regardless of the architecture.
Environment:
-
ehttp version: 0.6.0 -
Compile target: Native & WASM32
Images
@emilk
- 主要语言
- Rust
- 星标
- 404
- 派生
- 38
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
emilk/ehttp 的其他 Issue
-
难度 1/5 1-3 小时 新手友好度 68/100
-
难度 4/5 3-5 天 新手友好度 35/100
-
难度 4/5 3-5 天 新手友好度 25/100
-
难度 3/5 1-2 天 新手友好度 48/100
-
难度 3/5 1-2 天 新手友好度 35/100
相似的 Issue
-
triage: failed
难度 2/5 1-3 小时 新手友好度 68/100
oxc-project/tsrs#1277 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 85/100
维护者通常 1 天内回复
-
autofixer: follow-up triage: bug triage: classified triage: correctness triage: has-reproducer
难度 2/5 1-3 小时 新手友好度 67/100
tursodatabase/turso#13221 ·
维护者通常 1 天内回复
-
Update Wasmtime to 48.0.11 for RUSTSEC-2026-0648可能已有人在做 @flyingrobots 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 67/100
flyingrobots/edict#457 ·