Tutorial: invalid crate-type syntax and inconsistent command-component example
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 68/100
- Type d'issue
- Documentation
- Clarté
- Plutôt claire
- Activité
- Active
- Stack technique
- rust
- Domaine
- documentation
Piste de recherche
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.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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().
- Langage dominant
- Rust
- Étoiles
- 138
- Forks
- 89
- Merge moyen
- 10 h 38 min
- PR mergées (30 j)
- 2
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Aucun modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de bytecodealliance/component-docs
-
Difficulté 2/5 Une demi-journée Accessibilité débutants 72/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
-
[FEATURE] Add wasi-cli templatesOuverte
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
bytecodealliance/component-docs#294 · 1 commentaire ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 55/100
-
Add guide for HTTP P3Ouvertedocumentation enhancement lang/rust
Difficulté 3/5 1-2 jours Accessibilité débutants 78/100
Toutes les issues de bytecodealliance/component-docs
Issues similaires
-
[Bug]:设置的关于页面,“系统信息”部分排版异常Ouvertebug
Difficulté 2/5 1-3 heures Accessibilité débutants 63/100
metasequoiaime/msime#7328 ·
Les mainteneurs répondent en général sous 1 jour
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
eclipse-opensovd/classic-diagnostic-adapter#616 ·
Les mainteneurs répondent en général sous 2 jours
-
documentation
Difficulté 1/5 Moins d'une heure Accessibilité débutants 86/100
Les mainteneurs répondent en général sous 1 jour
-
track: content
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
0xAndersen/witness-log#10 ·
-
follow-up main-defect wave-A
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
carrick-sh/carrick#249 ·
Les mainteneurs répondent en général sous 1 jour