Tutorial: invalid crate-type syntax and inconsistent command-component example
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 68/100
- Issue-Typ
- Dokumentation
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- rust
- Bereich
- documentation
Rechercherichtung
Start with the Create a command component section in tutorial.html, then compare it with examples/tutorial/command/src/main.rs, examples/tutorial/command/Cargo.toml, and examples/tutorial/wit/calculator/world.wit. Choose one entrypoint approach and make the tutorial and completed example consistent, including valid crate-type syntax where applicable. Verify the documented project with cargo metadata --no-deps --format-version 1 --offline and the tutorial's build steps.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
The Create a command component section has two problems: an invalid Cargo configuration and a mismatch between the library-based instructions and the linked binary example.
1. Invalid crate-type syntax
The tutorial asks readers to create a library with cargo new --lib example and add:
[lib]
crate-type = "cdylib"
Running cargo metadata --no-deps --format-version 1 --offline in that project fails with:
error: invalid type: string "cdylib", expected a sequence
Reproduced with Cargo 1.98.1. The configuration should be:
[lib]
crate-type = ["cdylib"]
2. The completed example uses a different entrypoint approach
The tutorial creates a library crate and asks readers to add export wasi:cli/[email protected] to the app world. However, its linked completed example is a binary:
- src/main.rs uses an ordinary
fn main(). - Cargo.toml has no
[lib]configuration. - The app world imports
calculatebut does not explicitly exportwasi:cli/run.
Both approaches are valid, but copying that main() into the tutorial's library project does not implement the requested wasi:cli/run export. Fixing the manifest syntax alone does not resolve this mismatch.
The tutorial and completed example should use the same approach: either keep the cdylib instructions and provide the explicit run implementation and export, or use a binary project built for wasm32-wasip2, where Rust supplies the entrypoint for main().
- Vorherrschende Sprache
- Rust
- Sterne
- 138
- Forks
- 89
- Ø Merge
- 10 Std. 38 Min.
- Gemergte PRs (30 T.)
- 2
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus bytecodealliance/component-docs
-
Schwierigkeit 2/5 Ein halber Tag Anfängerfreundlichkeit 72/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 65/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
bytecodealliance/component-docs#294 · 1 Kommentar ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 55/100
-
Add guide for HTTP P3Offendocumentation enhancement lang/rust
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 78/100
Alle Issues in bytecodealliance/component-docs
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 69/100
router-for-me/EasyCLIProxyAPI#406 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 67/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 83/100
Maintainer antworten meist innerhalb von 1 Tag
-
ai-priority/P2 bug db/oracle user-priority/P1
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 67/100
Maintainer antworten meist innerhalb von 1 Tag
-
Sweep stale notesOffen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 63/100